parent
b28d4a6e9f
commit
bf5a406ffb
|
@ -13,7 +13,7 @@
|
|||
|
||||
### Removed
|
||||
|
||||
∅
|
||||
- **aiken-lang**: clause guards are no longer part of the language. See [#886](https://github.com/aiken-lang/aiken/issues/886). @KtorZ.
|
||||
|
||||
## v1.0.30-alpha - 2024-07-25
|
||||
|
||||
|
|
|
@ -10,5 +10,5 @@ platform = "github"
|
|||
|
||||
[[dependencies]]
|
||||
name = "aiken-lang/stdlib"
|
||||
version = "1.9.0"
|
||||
version = "main"
|
||||
source = "github"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::{
|
||||
builtins::{self, bool, g1_element, g2_element},
|
||||
builtins::{self, g1_element, g2_element},
|
||||
expr::{TypedExpr, UntypedExpr},
|
||||
line_numbers::LineNumbers,
|
||||
parser::token::{Base, Token},
|
||||
|
@ -1752,7 +1752,6 @@ pub type TypedMultiPattern = MultiPattern<PatternConstructor, Rc<Type>>;
|
|||
pub struct UntypedClause {
|
||||
pub location: Span,
|
||||
pub patterns: Vec1<Pattern<(), ()>>,
|
||||
pub guard: Option<ClauseGuard<()>>,
|
||||
pub then: UntypedExpr,
|
||||
}
|
||||
|
||||
|
@ -1760,7 +1759,6 @@ pub struct UntypedClause {
|
|||
pub struct TypedClause {
|
||||
pub location: Span,
|
||||
pub pattern: Pattern<PatternConstructor, Rc<Type>>,
|
||||
pub guard: Option<ClauseGuard<Rc<Type>>>,
|
||||
pub then: TypedExpr,
|
||||
}
|
||||
|
||||
|
@ -1779,123 +1777,7 @@ impl TypedClause {
|
|||
}
|
||||
}
|
||||
|
||||
pub type UntypedClauseGuard = ClauseGuard<()>;
|
||||
pub type TypedClauseGuard = ClauseGuard<Rc<Type>>;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||
pub enum ClauseGuard<Type> {
|
||||
Not {
|
||||
location: Span,
|
||||
value: Box<Self>,
|
||||
},
|
||||
|
||||
Equals {
|
||||
location: Span,
|
||||
left: Box<Self>,
|
||||
right: Box<Self>,
|
||||
},
|
||||
|
||||
NotEquals {
|
||||
location: Span,
|
||||
left: Box<Self>,
|
||||
right: Box<Self>,
|
||||
},
|
||||
|
||||
GtInt {
|
||||
location: Span,
|
||||
left: Box<Self>,
|
||||
right: Box<Self>,
|
||||
},
|
||||
|
||||
GtEqInt {
|
||||
location: Span,
|
||||
left: Box<Self>,
|
||||
right: Box<Self>,
|
||||
},
|
||||
|
||||
LtInt {
|
||||
location: Span,
|
||||
left: Box<Self>,
|
||||
right: Box<Self>,
|
||||
},
|
||||
|
||||
LtEqInt {
|
||||
location: Span,
|
||||
left: Box<Self>,
|
||||
right: Box<Self>,
|
||||
},
|
||||
|
||||
Or {
|
||||
location: Span,
|
||||
left: Box<Self>,
|
||||
right: Box<Self>,
|
||||
},
|
||||
|
||||
And {
|
||||
location: Span,
|
||||
left: Box<Self>,
|
||||
right: Box<Self>,
|
||||
},
|
||||
|
||||
Var {
|
||||
location: Span,
|
||||
tipo: Type,
|
||||
name: String,
|
||||
},
|
||||
|
||||
Constant(Constant),
|
||||
}
|
||||
|
||||
impl<A> ClauseGuard<A> {
|
||||
pub fn location(&self) -> Span {
|
||||
match self {
|
||||
ClauseGuard::Constant(constant) => constant.location(),
|
||||
ClauseGuard::Not { location, .. }
|
||||
| ClauseGuard::Or { location, .. }
|
||||
| ClauseGuard::And { location, .. }
|
||||
| ClauseGuard::Var { location, .. }
|
||||
| ClauseGuard::Equals { location, .. }
|
||||
| ClauseGuard::NotEquals { location, .. }
|
||||
| ClauseGuard::GtInt { location, .. }
|
||||
| ClauseGuard::GtEqInt { location, .. }
|
||||
| ClauseGuard::LtInt { location, .. }
|
||||
| ClauseGuard::LtEqInt { location, .. } => *location,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn precedence(&self) -> u8 {
|
||||
// Ensure that this matches the other precedence function for guards
|
||||
match self {
|
||||
ClauseGuard::Not { .. } => 1,
|
||||
ClauseGuard::Or { .. } => 2,
|
||||
ClauseGuard::And { .. } => 3,
|
||||
ClauseGuard::Equals { .. } | ClauseGuard::NotEquals { .. } => 4,
|
||||
ClauseGuard::GtInt { .. }
|
||||
| ClauseGuard::GtEqInt { .. }
|
||||
| ClauseGuard::LtInt { .. }
|
||||
| ClauseGuard::LtEqInt { .. } => 5,
|
||||
ClauseGuard::Constant(_) | ClauseGuard::Var { .. } => 6,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl TypedClauseGuard {
|
||||
pub fn tipo(&self) -> Rc<Type> {
|
||||
match self {
|
||||
ClauseGuard::Var { tipo, .. } => tipo.clone(),
|
||||
ClauseGuard::Constant(constant) => constant.tipo(),
|
||||
ClauseGuard::Not { .. }
|
||||
| ClauseGuard::Or { .. }
|
||||
| ClauseGuard::And { .. }
|
||||
| ClauseGuard::Equals { .. }
|
||||
| ClauseGuard::NotEquals { .. }
|
||||
| ClauseGuard::GtInt { .. }
|
||||
| ClauseGuard::GtEqInt { .. }
|
||||
| ClauseGuard::LtInt { .. }
|
||||
| ClauseGuard::LtEqInt { .. } => bool(),
|
||||
}
|
||||
}
|
||||
}
|
||||
pub struct UntypedClauseGuard {}
|
||||
|
||||
pub type TypedIfBranch = IfBranch<TypedExpr, TypedPattern>;
|
||||
pub type UntypedIfBranch = IfBranch<UntypedExpr, AssignmentPattern>;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
use crate::{
|
||||
ast::{
|
||||
Annotation, ArgBy, ArgName, ArgVia, AssignmentKind, AssignmentPattern, BinOp,
|
||||
ByteArrayFormatPreference, CallArg, ClauseGuard, Constant, CurveType, DataType, Definition,
|
||||
Function, LogicalOpChainKind, ModuleConstant, OnTestFailure, Pattern, RecordConstructor,
|
||||
ByteArrayFormatPreference, CallArg, Constant, CurveType, DataType, Definition, Function,
|
||||
LogicalOpChainKind, ModuleConstant, OnTestFailure, Pattern, RecordConstructor,
|
||||
RecordConstructorArg, RecordUpdateSpread, Span, TraceKind, TypeAlias, TypedArg, UnOp,
|
||||
UnqualifiedImport, UntypedArg, UntypedArgVia, UntypedAssignmentKind, UntypedClause,
|
||||
UntypedClauseGuard, UntypedDefinition, UntypedFunction, UntypedIfBranch, UntypedModule,
|
||||
UntypedPattern, UntypedRecordUpdateArg, Use, Validator, CAPTURE_VARIABLE,
|
||||
UntypedDefinition, UntypedFunction, UntypedIfBranch, UntypedModule, UntypedPattern,
|
||||
UntypedRecordUpdateArg, Use, Validator, CAPTURE_VARIABLE,
|
||||
},
|
||||
docvec,
|
||||
expr::{FnStyle, UntypedExpr, DEFAULT_ERROR_STR, DEFAULT_TODO_STR},
|
||||
|
@ -1844,10 +1844,6 @@ impl<'comments> Formatter<'comments> {
|
|||
clause.patterns.iter().map(|p| self.pattern(p)),
|
||||
" | ".to_doc(),
|
||||
);
|
||||
let clause_doc = match &clause.guard {
|
||||
None => clause_doc,
|
||||
Some(guard) => clause_doc.append(" if ").append(self.clause_guard(guard)),
|
||||
};
|
||||
|
||||
if index == 0 {
|
||||
clause_doc
|
||||
|
@ -1946,61 +1942,6 @@ impl<'comments> Formatter<'comments> {
|
|||
commented(doc, comments)
|
||||
}
|
||||
|
||||
pub fn clause_guard_bin_op<'a>(
|
||||
&mut self,
|
||||
name: &'a str,
|
||||
name_precedence: u8,
|
||||
left: &'a UntypedClauseGuard,
|
||||
right: &'a UntypedClauseGuard,
|
||||
) -> Document<'a> {
|
||||
let left_precedence = left.precedence();
|
||||
let right_precedence = right.precedence();
|
||||
let left = self.clause_guard(left);
|
||||
let right = self.clause_guard(right);
|
||||
self.operator_side(left, name_precedence, left_precedence)
|
||||
.append(name)
|
||||
.append(self.operator_side(right, name_precedence, right_precedence.saturating_sub(1)))
|
||||
}
|
||||
|
||||
fn clause_guard<'a>(&mut self, clause_guard: &'a UntypedClauseGuard) -> Document<'a> {
|
||||
match clause_guard {
|
||||
ClauseGuard::Not { value, .. } => {
|
||||
docvec!["!", self.clause_guard(value)]
|
||||
}
|
||||
ClauseGuard::And { left, right, .. } => {
|
||||
self.clause_guard_bin_op(" && ", clause_guard.precedence(), left, right)
|
||||
}
|
||||
ClauseGuard::Or { left, right, .. } => {
|
||||
self.clause_guard_bin_op(" || ", clause_guard.precedence(), left, right)
|
||||
}
|
||||
ClauseGuard::Equals { left, right, .. } => {
|
||||
self.clause_guard_bin_op(" == ", clause_guard.precedence(), left, right)
|
||||
}
|
||||
|
||||
ClauseGuard::NotEquals { left, right, .. } => {
|
||||
self.clause_guard_bin_op(" != ", clause_guard.precedence(), left, right)
|
||||
}
|
||||
ClauseGuard::GtInt { left, right, .. } => {
|
||||
self.clause_guard_bin_op(" > ", clause_guard.precedence(), left, right)
|
||||
}
|
||||
|
||||
ClauseGuard::GtEqInt { left, right, .. } => {
|
||||
self.clause_guard_bin_op(" >= ", clause_guard.precedence(), left, right)
|
||||
}
|
||||
ClauseGuard::LtInt { left, right, .. } => {
|
||||
self.clause_guard_bin_op(" < ", clause_guard.precedence(), left, right)
|
||||
}
|
||||
|
||||
ClauseGuard::LtEqInt { left, right, .. } => {
|
||||
self.clause_guard_bin_op(" <= ", clause_guard.precedence(), left, right)
|
||||
}
|
||||
|
||||
ClauseGuard::Var { name, .. } => name.to_doc(),
|
||||
|
||||
ClauseGuard::Constant(constant) => self.const_expr(constant),
|
||||
}
|
||||
}
|
||||
|
||||
fn un_op<'a>(&mut self, value: &'a UntypedExpr, op: &'a UnOp) -> Document<'a> {
|
||||
match op {
|
||||
UnOp::Not => docvec!["!", self.wrap_unary_op(value)],
|
||||
|
|
|
@ -1970,28 +1970,7 @@ impl<'a> CodeGenerator<'a> {
|
|||
props.complex_clause = false;
|
||||
|
||||
if let Some((clause, rest_clauses)) = clauses.split_first() {
|
||||
let mut clause_then = self.build(&clause.then, module_name, &[]);
|
||||
|
||||
// handles clause guard if it exists
|
||||
if let Some(guard) = &clause.guard {
|
||||
props.complex_clause = true;
|
||||
|
||||
let clause_guard_name = format!(
|
||||
"__clause_guard_span_{}_{}",
|
||||
clause.location.start, clause.location.end
|
||||
);
|
||||
|
||||
clause_then = AirTree::let_assignment(
|
||||
&clause_guard_name,
|
||||
builder::handle_clause_guard(guard),
|
||||
AirTree::clause_guard(
|
||||
&clause_guard_name,
|
||||
AirTree::bool(true),
|
||||
bool(),
|
||||
clause_then,
|
||||
),
|
||||
);
|
||||
}
|
||||
let clause_then = self.build(&clause.then, module_name, &[]);
|
||||
|
||||
match &mut props.specific_clause {
|
||||
// TODO: Implement PairClause and PairClauseGuard
|
||||
|
@ -2170,7 +2149,7 @@ impl<'a> CodeGenerator<'a> {
|
|||
}
|
||||
};
|
||||
|
||||
let mut is_wild_card_elems_clause = clause.guard.is_none();
|
||||
let mut is_wild_card_elems_clause = true;
|
||||
for element in elements.iter() {
|
||||
is_wild_card_elems_clause = is_wild_card_elems_clause
|
||||
&& !pattern_has_conditions(element, &self.data_types);
|
||||
|
@ -2320,8 +2299,6 @@ impl<'a> CodeGenerator<'a> {
|
|||
// handle final_clause
|
||||
props.final_clause = true;
|
||||
|
||||
assert!(final_clause.guard.is_none());
|
||||
|
||||
let clause_then = self.build(&final_clause.then, module_name, &[]);
|
||||
|
||||
let (condition, assignments) =
|
||||
|
|
|
@ -4,11 +4,10 @@ use super::{
|
|||
};
|
||||
use crate::{
|
||||
ast::{
|
||||
BinOp, ClauseGuard, Constant, DataTypeKey, FunctionAccessKey, Pattern, Span, TraceLevel,
|
||||
TypedArg, TypedAssignmentKind, TypedClause, TypedClauseGuard, TypedDataType, TypedPattern,
|
||||
UnOp,
|
||||
Constant, DataTypeKey, FunctionAccessKey, Pattern, Span, TraceLevel, TypedArg,
|
||||
TypedAssignmentKind, TypedClause, TypedDataType, TypedPattern,
|
||||
},
|
||||
builtins::{bool, data, function, int, list, void},
|
||||
builtins::{data, function, int, list, void},
|
||||
expr::TypedExpr,
|
||||
line_numbers::{LineColumn, LineNumbers},
|
||||
tipo::{
|
||||
|
@ -298,66 +297,6 @@ pub fn constants_ir(literal: &Constant) -> AirTree {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn handle_clause_guard(clause_guard: &TypedClauseGuard) -> AirTree {
|
||||
match clause_guard {
|
||||
ClauseGuard::Not { value, .. } => {
|
||||
let val = handle_clause_guard(value);
|
||||
|
||||
AirTree::unop(UnOp::Not, val)
|
||||
}
|
||||
ClauseGuard::Equals { left, right, .. } => {
|
||||
let left_child = handle_clause_guard(left);
|
||||
let right_child = handle_clause_guard(right);
|
||||
|
||||
AirTree::binop(BinOp::Eq, bool(), left_child, right_child, left.tipo())
|
||||
}
|
||||
ClauseGuard::NotEquals { left, right, .. } => {
|
||||
let left_child = handle_clause_guard(left);
|
||||
let right_child = handle_clause_guard(right);
|
||||
|
||||
AirTree::binop(BinOp::NotEq, bool(), left_child, right_child, left.tipo())
|
||||
}
|
||||
ClauseGuard::GtInt { left, right, .. } => {
|
||||
let left_child = handle_clause_guard(left);
|
||||
let right_child = handle_clause_guard(right);
|
||||
|
||||
AirTree::binop(BinOp::GtInt, bool(), left_child, right_child, left.tipo())
|
||||
}
|
||||
ClauseGuard::GtEqInt { left, right, .. } => {
|
||||
let left_child = handle_clause_guard(left);
|
||||
let right_child = handle_clause_guard(right);
|
||||
|
||||
AirTree::binop(BinOp::GtEqInt, bool(), left_child, right_child, left.tipo())
|
||||
}
|
||||
ClauseGuard::LtInt { left, right, .. } => {
|
||||
let left_child = handle_clause_guard(left);
|
||||
let right_child = handle_clause_guard(right);
|
||||
|
||||
AirTree::binop(BinOp::LtInt, bool(), left_child, right_child, left.tipo())
|
||||
}
|
||||
ClauseGuard::LtEqInt { left, right, .. } => {
|
||||
let left_child = handle_clause_guard(left);
|
||||
let right_child = handle_clause_guard(right);
|
||||
|
||||
AirTree::binop(BinOp::LtEqInt, bool(), left_child, right_child, left.tipo())
|
||||
}
|
||||
ClauseGuard::Or { left, right, .. } => {
|
||||
let left_child = handle_clause_guard(left);
|
||||
let right_child = handle_clause_guard(right);
|
||||
|
||||
AirTree::binop(BinOp::Or, bool(), left_child, right_child, left.tipo())
|
||||
}
|
||||
ClauseGuard::And { left, right, .. } => {
|
||||
let left_child = handle_clause_guard(left);
|
||||
let right_child = handle_clause_guard(right);
|
||||
|
||||
AirTree::binop(BinOp::And, bool(), left_child, right_child, left.tipo())
|
||||
}
|
||||
ClauseGuard::Var { tipo, name, .. } => AirTree::local_var(name, tipo.clone()),
|
||||
ClauseGuard::Constant(constant) => constants_ir(constant),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_generic_variant_name(t: &Rc<Type>) -> String {
|
||||
let uplc_type = t.get_uplc_type();
|
||||
|
||||
|
@ -726,18 +665,16 @@ pub fn rearrange_list_clauses(
|
|||
|
||||
let clause1_len = match clause_pattern1 {
|
||||
Pattern::List { elements, tail, .. } => {
|
||||
Some(elements.len() + usize::from(tail.is_some() && clause1.guard.is_none()))
|
||||
Some(elements.len() + usize::from(tail.is_some()))
|
||||
}
|
||||
_ if clause1.guard.is_none() => Some(100000),
|
||||
_ => None,
|
||||
_ => Some(100000),
|
||||
};
|
||||
|
||||
let clause2_len = match clause_pattern2 {
|
||||
Pattern::List { elements, tail, .. } => {
|
||||
Some(elements.len() + usize::from(tail.is_some() && clause2.guard.is_none()))
|
||||
Some(elements.len() + usize::from(tail.is_some()))
|
||||
}
|
||||
_ if clause2.guard.is_none() => Some(100001),
|
||||
_ => None,
|
||||
_ => Some(100001),
|
||||
};
|
||||
|
||||
if let Some(clause1_len) = clause1_len {
|
||||
|
@ -759,31 +696,11 @@ pub fn rearrange_list_clauses(
|
|||
|
||||
// If we have a catch all, use that. Otherwise use todo which will result in error
|
||||
// TODO: fill in todo label with description
|
||||
let plug_in_then = &|index: usize, last_clause: &TypedClause| {
|
||||
if last_clause.guard.is_none() {
|
||||
match &last_clause.pattern {
|
||||
let plug_in_then = &|index: usize, last_clause: &TypedClause| match &last_clause.pattern {
|
||||
Pattern::Var { .. } | Pattern::Discard { .. } => last_clause.clone().then,
|
||||
_ => {
|
||||
let tipo = last_clause.then.tipo();
|
||||
|
||||
TypedExpr::Trace {
|
||||
location: Span::empty(),
|
||||
tipo: tipo.clone(),
|
||||
text: Box::new(TypedExpr::String {
|
||||
location: Span::empty(),
|
||||
tipo: crate::builtins::string(),
|
||||
value: format!("Clause hole found for {index} elements."),
|
||||
}),
|
||||
then: Box::new(TypedExpr::ErrorTerm {
|
||||
location: Span::empty(),
|
||||
tipo,
|
||||
}),
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let tipo = last_clause.then.tipo();
|
||||
|
||||
TypedExpr::Trace {
|
||||
location: Span::empty(),
|
||||
tipo: tipo.clone(),
|
||||
|
@ -849,7 +766,6 @@ pub fn rearrange_list_clauses(
|
|||
}
|
||||
.into(),
|
||||
},
|
||||
guard: None,
|
||||
then: plug_in_then(wild_card_clause_elems, last_clause),
|
||||
}
|
||||
} else {
|
||||
|
@ -860,7 +776,6 @@ pub fn rearrange_list_clauses(
|
|||
elements: discard_elems,
|
||||
tail: None,
|
||||
},
|
||||
guard: None,
|
||||
then: plug_in_then(wild_card_clause_elems, last_clause),
|
||||
}
|
||||
};
|
||||
|
@ -869,7 +784,7 @@ pub fn rearrange_list_clauses(
|
|||
wild_card_clause_elems += 1;
|
||||
}
|
||||
|
||||
let mut is_wild_card_elems_clause = clause.guard.is_none();
|
||||
let mut is_wild_card_elems_clause = true;
|
||||
|
||||
for element in elements.iter() {
|
||||
is_wild_card_elems_clause =
|
||||
|
@ -881,16 +796,14 @@ pub fn rearrange_list_clauses(
|
|||
wild_card_clause_elems += 1;
|
||||
}
|
||||
|
||||
if clause.guard.is_none() && tail.is_some() && !elements.is_empty() {
|
||||
if tail.is_some() && !elements.is_empty() {
|
||||
last_clause_index = index;
|
||||
last_clause_set = true;
|
||||
}
|
||||
}
|
||||
} else if let Pattern::Var { .. } | Pattern::Discard { .. } = &clause.pattern {
|
||||
if clause.guard.is_none() {
|
||||
last_clause_set = true;
|
||||
last_clause_index = index;
|
||||
}
|
||||
} else {
|
||||
unreachable!("Found a clause that is not a list or var or discard");
|
||||
}
|
||||
|
@ -904,7 +817,6 @@ pub fn rearrange_list_clauses(
|
|||
name: "_".to_string(),
|
||||
location: Span::empty(),
|
||||
},
|
||||
guard: None,
|
||||
then: plug_in_then(index + 1, last_clause),
|
||||
});
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ use std::collections::HashSet;
|
|||
)]
|
||||
pub struct ParseError {
|
||||
pub kind: ErrorKind,
|
||||
#[label]
|
||||
#[label("{}", .label.unwrap_or_default())]
|
||||
pub span: Span,
|
||||
#[allow(dead_code)]
|
||||
while_parsing: Option<(Span, &'static str)>,
|
||||
|
@ -83,13 +83,13 @@ impl ParseError {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn invalid_when_clause_guard(span: Span) -> Self {
|
||||
pub fn deprecated_when_clause_guard(span: Span) -> Self {
|
||||
Self {
|
||||
kind: ErrorKind::InvalidWhenClause,
|
||||
kind: ErrorKind::DeprecatedWhenClause,
|
||||
span,
|
||||
while_parsing: None,
|
||||
expected: HashSet::new(),
|
||||
label: Some("invalid clause guard"),
|
||||
label: Some("deprecated"),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -249,35 +249,17 @@ pub enum ErrorKind {
|
|||
}))]
|
||||
MalformedBase16StringLiteral,
|
||||
|
||||
#[error("I came across a bytearray declared using two different notations")]
|
||||
#[error("I came across a bytearray declared using two different notations.")]
|
||||
#[diagnostic(url("https://aiken-lang.org/language-tour/primitive-types#bytearray"))]
|
||||
#[diagnostic(help("Either use decimal or hexadecimal notation, but don't mix them."))]
|
||||
HybridNotationInByteArray,
|
||||
|
||||
#[error("I failed to understand a when clause guard.")]
|
||||
#[diagnostic(url(
|
||||
"https://aiken-lang.org/language-tour/control-flow#checking-equality-and-ordering-in-patterns"
|
||||
))]
|
||||
#[error("I found a now-deprecated clause guard in a when/is expression.")]
|
||||
#[diagnostic(help("{}", formatdoc! {
|
||||
r#"Clause guards are not as capable as standard expressions. While you can combine multiple clauses using '{operator_or}' and '{operator_and}', you can't do any arithmetic in there. They are mainly meant to compare pattern variables to some known constants using simple binary operators.
|
||||
|
||||
For example, the following clauses are well-formed:
|
||||
|
||||
{good} (x, _) if x == 10 -> ...
|
||||
{good} (_, y) if y > 0 && y < 10 -> ...
|
||||
{good} (x, y) if x && (y > 0 || y < 10) -> ...
|
||||
|
||||
However, those aren't:
|
||||
|
||||
{bad} (x, _) if x % 3 == 0 -> ...
|
||||
{bad} (x, y) if x + y > 42 -> ...
|
||||
r#"Clause guards have been removed from Aiken. They were underused, considered potentially harmful and created needless complexity in the compiler. If you were using clause guards, our apologies, but you can now update your code and move the clause guards patterns inside a nested if/else expression.
|
||||
"#
|
||||
, operator_or = "||".if_supports_color(Stdout, |s| s.yellow())
|
||||
, operator_and = "&&".if_supports_color(Stdout, |s| s.yellow())
|
||||
, good = "✔️".if_supports_color(Stdout, |s| s.green())
|
||||
, bad = "✖️".if_supports_color(Stdout, |s| s.red())
|
||||
}))]
|
||||
InvalidWhenClause,
|
||||
DeprecatedWhenClause,
|
||||
}
|
||||
|
||||
fn fmt_curve_type(curve: &CurveType) -> String {
|
||||
|
|
|
@ -1,45 +1,41 @@
|
|||
use chumsky::prelude::*;
|
||||
use vec1::vec1;
|
||||
|
||||
use super::guard;
|
||||
use crate::{
|
||||
ast,
|
||||
expr::UntypedExpr,
|
||||
parser::{error::ParseError, pattern, token::Token},
|
||||
};
|
||||
|
||||
use super::guard;
|
||||
use chumsky::prelude::*;
|
||||
use vec1::vec1;
|
||||
|
||||
pub fn parser(
|
||||
expression: Recursive<'_, Token, UntypedExpr, ParseError>,
|
||||
) -> impl Parser<Token, ast::UntypedClause, Error = ParseError> + '_ {
|
||||
pattern()
|
||||
.then(just(Token::Vbar).ignore_then(pattern()).repeated().or_not())
|
||||
.then(choice((
|
||||
just(Token::If)
|
||||
.then(choice((just(Token::If)
|
||||
.ignore_then(guard())
|
||||
.or_not()
|
||||
.then_ignore(just(Token::RArrow)),
|
||||
just(Token::If)
|
||||
.ignore_then(take_until(just(Token::RArrow)))
|
||||
.validate(|_value, span, emit| {
|
||||
emit(ParseError::invalid_when_clause_guard(span));
|
||||
None
|
||||
}),
|
||||
)))
|
||||
.then_ignore(just(Token::RArrow)),)))
|
||||
// TODO: add hint "Did you mean to wrap a multi line clause in curly braces?"
|
||||
.then(expression)
|
||||
.map_with_span(
|
||||
|(((pattern, alternative_patterns_opt), guard), then), span| {
|
||||
.validate(
|
||||
|(((pattern, alternative_patterns_opt), guard), then), span, emit| {
|
||||
if guard.is_some() {
|
||||
emit(ParseError::deprecated_when_clause_guard(span));
|
||||
}
|
||||
|
||||
(pattern, alternative_patterns_opt, then)
|
||||
},
|
||||
)
|
||||
.map_with_span(|(pattern, alternative_patterns_opt, then), span| {
|
||||
let mut patterns = vec1![pattern];
|
||||
patterns.append(&mut alternative_patterns_opt.unwrap_or_default());
|
||||
ast::UntypedClause {
|
||||
location: span,
|
||||
patterns,
|
||||
guard,
|
||||
then,
|
||||
}
|
||||
},
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
use chumsky::prelude::*;
|
||||
|
||||
use crate::{
|
||||
ast,
|
||||
parser::{definition, error::ParseError, token::Token},
|
||||
};
|
||||
use chumsky::prelude::*;
|
||||
|
||||
pub fn parser() -> impl Parser<Token, ast::UntypedClauseGuard, Error = ParseError> {
|
||||
recursive(|expression| {
|
||||
|
@ -11,13 +10,9 @@ pub fn parser() -> impl Parser<Token, ast::UntypedClauseGuard, Error = ParseErro
|
|||
Token::Name { name } => name,
|
||||
Token::UpName { name } => name,
|
||||
}
|
||||
.map_with_span(|name, span| ast::ClauseGuard::Var {
|
||||
name,
|
||||
tipo: (),
|
||||
location: span,
|
||||
});
|
||||
.map_with_span(|_name, _span| ast::UntypedClauseGuard {});
|
||||
|
||||
let constant_parser = definition::constant::value().map(ast::ClauseGuard::Constant);
|
||||
let constant_parser = definition::constant::value().map(|_| ast::UntypedClauseGuard {});
|
||||
|
||||
let block_parser = expression
|
||||
.clone()
|
||||
|
@ -31,10 +26,7 @@ pub fn parser() -> impl Parser<Token, ast::UntypedClauseGuard, Error = ParseErro
|
|||
.map_with_span(|op, span| (op, span))
|
||||
.repeated()
|
||||
.then(leaf_parser)
|
||||
.foldr(|(_, span), value| ast::ClauseGuard::Not {
|
||||
location: span.union(value.location()),
|
||||
value: Box::new(value),
|
||||
})
|
||||
.foldr(|(_, _span), _value| ast::UntypedClauseGuard {})
|
||||
.boxed();
|
||||
|
||||
let comparison_op = choice((
|
||||
|
@ -49,74 +41,19 @@ pub fn parser() -> impl Parser<Token, ast::UntypedClauseGuard, Error = ParseErro
|
|||
let comparison = unary
|
||||
.clone()
|
||||
.then(comparison_op.then(unary).repeated())
|
||||
.foldl(|left, (op, right)| {
|
||||
let location = left.location().union(right.location());
|
||||
let left = Box::new(left);
|
||||
let right = Box::new(right);
|
||||
match op {
|
||||
ast::BinOp::Eq => ast::ClauseGuard::Equals {
|
||||
location,
|
||||
left,
|
||||
right,
|
||||
},
|
||||
ast::BinOp::NotEq => ast::ClauseGuard::NotEquals {
|
||||
location,
|
||||
left,
|
||||
right,
|
||||
},
|
||||
ast::BinOp::LtInt => ast::ClauseGuard::LtInt {
|
||||
location,
|
||||
left,
|
||||
right,
|
||||
},
|
||||
ast::BinOp::GtInt => ast::ClauseGuard::GtInt {
|
||||
location,
|
||||
left,
|
||||
right,
|
||||
},
|
||||
ast::BinOp::LtEqInt => ast::ClauseGuard::LtEqInt {
|
||||
location,
|
||||
left,
|
||||
right,
|
||||
},
|
||||
ast::BinOp::GtEqInt => ast::ClauseGuard::GtEqInt {
|
||||
location,
|
||||
left,
|
||||
right,
|
||||
},
|
||||
_ => unreachable!(),
|
||||
}
|
||||
})
|
||||
.foldl(|_left, (_op, _right)| ast::UntypedClauseGuard {})
|
||||
.boxed();
|
||||
|
||||
let and_op = just(Token::AmperAmper);
|
||||
let conjunction = comparison
|
||||
.clone()
|
||||
.then(and_op.then(comparison).repeated())
|
||||
.foldl(|left, (_tok, right)| {
|
||||
let location = left.location().union(right.location());
|
||||
let left = Box::new(left);
|
||||
let right = Box::new(right);
|
||||
ast::ClauseGuard::And {
|
||||
location,
|
||||
left,
|
||||
right,
|
||||
}
|
||||
});
|
||||
.foldl(|_left, (_tok, _right)| ast::UntypedClauseGuard {});
|
||||
|
||||
let or_op = just(Token::VbarVbar);
|
||||
conjunction
|
||||
.clone()
|
||||
.then(or_op.then(conjunction).repeated())
|
||||
.foldl(|left, (_tok, right)| {
|
||||
let location = left.location().union(right.location());
|
||||
let left = Box::new(left);
|
||||
let right = Box::new(right);
|
||||
ast::ClauseGuard::Or {
|
||||
location,
|
||||
left,
|
||||
right,
|
||||
}
|
||||
})
|
||||
.foldl(|_left, (_tok, _right)| ast::UntypedClauseGuard {})
|
||||
})
|
||||
}
|
||||
|
|
|
@ -3,13 +3,12 @@ use chumsky::prelude::*;
|
|||
mod clause;
|
||||
mod guard;
|
||||
|
||||
pub use clause::parser as clause;
|
||||
pub use guard::parser as guard;
|
||||
|
||||
use crate::{
|
||||
expr::UntypedExpr,
|
||||
parser::{error::ParseError, token::Token},
|
||||
};
|
||||
pub use clause::parser as clause;
|
||||
pub use guard::parser as guard;
|
||||
|
||||
pub fn parser(
|
||||
expression: Recursive<'_, Token, UntypedExpr, ParseError>,
|
||||
|
@ -38,7 +37,6 @@ mod tests {
|
|||
assert_expr!(
|
||||
r#"
|
||||
when a is {
|
||||
2 if x > 1 -> 3
|
||||
1 | 4 | 5 -> {
|
||||
let amazing = 5
|
||||
amazing
|
||||
|
@ -49,4 +47,16 @@ mod tests {
|
|||
"#
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn when_guard_deprecation() {
|
||||
assert_expr!(
|
||||
r#"
|
||||
when a is {
|
||||
2 if x > 1 -> 3
|
||||
_ -> 1
|
||||
}
|
||||
"#
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,85 +1,46 @@
|
|||
---
|
||||
source: crates/aiken-lang/src/parser/expr/when/mod.rs
|
||||
description: "Code:\n\nwhen a is {\n 2 if x > 1 -> 3\n 1 | 4 | 5 -> {\n let amazing = 5\n amazing\n }\n 3 -> 9\n _ -> 4\n}\n"
|
||||
description: "Code:\n\nwhen a is {\n 1 | 4 | 5 -> {\n let amazing = 5\n amazing\n }\n 3 -> 9\n _ -> 4\n}\n"
|
||||
---
|
||||
When {
|
||||
location: 0..102,
|
||||
location: 0..84,
|
||||
subject: Var {
|
||||
location: 5..6,
|
||||
name: "a",
|
||||
},
|
||||
clauses: [
|
||||
UntypedClause {
|
||||
location: 14..29,
|
||||
location: 14..64,
|
||||
patterns: [
|
||||
Int {
|
||||
location: 14..15,
|
||||
value: "2",
|
||||
base: Decimal {
|
||||
numeric_underscore: false,
|
||||
},
|
||||
},
|
||||
],
|
||||
guard: Some(
|
||||
GtInt {
|
||||
location: 19..24,
|
||||
left: Var {
|
||||
location: 19..20,
|
||||
tipo: (),
|
||||
name: "x",
|
||||
},
|
||||
right: Constant(
|
||||
Int {
|
||||
location: 23..24,
|
||||
value: "1",
|
||||
base: Decimal {
|
||||
numeric_underscore: false,
|
||||
},
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
then: UInt {
|
||||
location: 28..29,
|
||||
value: "3",
|
||||
base: Decimal {
|
||||
numeric_underscore: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
UntypedClause {
|
||||
location: 32..82,
|
||||
patterns: [
|
||||
Int {
|
||||
location: 32..33,
|
||||
value: "1",
|
||||
base: Decimal {
|
||||
numeric_underscore: false,
|
||||
},
|
||||
},
|
||||
Int {
|
||||
location: 36..37,
|
||||
location: 18..19,
|
||||
value: "4",
|
||||
base: Decimal {
|
||||
numeric_underscore: false,
|
||||
},
|
||||
},
|
||||
Int {
|
||||
location: 40..41,
|
||||
location: 22..23,
|
||||
value: "5",
|
||||
base: Decimal {
|
||||
numeric_underscore: false,
|
||||
},
|
||||
},
|
||||
],
|
||||
guard: None,
|
||||
then: Sequence {
|
||||
location: 51..78,
|
||||
location: 33..60,
|
||||
expressions: [
|
||||
Assignment {
|
||||
location: 51..66,
|
||||
location: 33..48,
|
||||
value: UInt {
|
||||
location: 65..66,
|
||||
location: 47..48,
|
||||
value: "5",
|
||||
base: Decimal {
|
||||
numeric_underscore: false,
|
||||
|
@ -88,11 +49,11 @@ When {
|
|||
patterns: [
|
||||
AssignmentPattern {
|
||||
pattern: Var {
|
||||
location: 55..62,
|
||||
location: 37..44,
|
||||
name: "amazing",
|
||||
},
|
||||
annotation: None,
|
||||
location: 55..62,
|
||||
location: 37..44,
|
||||
},
|
||||
],
|
||||
kind: Let {
|
||||
|
@ -100,26 +61,25 @@ When {
|
|||
},
|
||||
},
|
||||
Var {
|
||||
location: 71..78,
|
||||
location: 53..60,
|
||||
name: "amazing",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
UntypedClause {
|
||||
location: 85..91,
|
||||
location: 67..73,
|
||||
patterns: [
|
||||
Int {
|
||||
location: 85..86,
|
||||
location: 67..68,
|
||||
value: "3",
|
||||
base: Decimal {
|
||||
numeric_underscore: false,
|
||||
},
|
||||
},
|
||||
],
|
||||
guard: None,
|
||||
then: UInt {
|
||||
location: 90..91,
|
||||
location: 72..73,
|
||||
value: "9",
|
||||
base: Decimal {
|
||||
numeric_underscore: false,
|
||||
|
@ -127,16 +87,15 @@ When {
|
|||
},
|
||||
},
|
||||
UntypedClause {
|
||||
location: 94..100,
|
||||
location: 76..82,
|
||||
patterns: [
|
||||
Discard {
|
||||
name: "_",
|
||||
location: 94..95,
|
||||
location: 76..77,
|
||||
},
|
||||
],
|
||||
guard: None,
|
||||
then: UInt {
|
||||
location: 99..100,
|
||||
location: 81..82,
|
||||
value: "4",
|
||||
base: Decimal {
|
||||
numeric_underscore: false,
|
||||
|
|
|
@ -25,7 +25,6 @@ When {
|
|||
tipo: (),
|
||||
},
|
||||
],
|
||||
guard: None,
|
||||
then: Trace {
|
||||
kind: Todo,
|
||||
location: 28..32,
|
||||
|
@ -55,7 +54,6 @@ When {
|
|||
tipo: (),
|
||||
},
|
||||
],
|
||||
guard: None,
|
||||
then: Trace {
|
||||
kind: Todo,
|
||||
location: 47..51,
|
||||
|
|
|
@ -25,7 +25,6 @@ When {
|
|||
tipo: (),
|
||||
},
|
||||
],
|
||||
guard: None,
|
||||
then: ErrorTerm {
|
||||
location: 28..32,
|
||||
},
|
||||
|
|
|
@ -25,7 +25,6 @@ When {
|
|||
tipo: (),
|
||||
},
|
||||
],
|
||||
guard: None,
|
||||
then: Var {
|
||||
location: 28..32,
|
||||
name: "True",
|
||||
|
@ -47,7 +46,6 @@ When {
|
|||
tipo: (),
|
||||
},
|
||||
],
|
||||
guard: None,
|
||||
then: Trace {
|
||||
kind: Todo,
|
||||
location: 47..68,
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
---
|
||||
source: crates/aiken-lang/src/parser/expr/when/mod.rs
|
||||
description: "Invalid code (parse error):\n\nwhen a is {\n 2 if x > 1 -> 3\n _ -> 1\n}\n"
|
||||
---
|
||||
[
|
||||
ParseError {
|
||||
kind: DeprecatedWhenClause,
|
||||
span: 14..29,
|
||||
while_parsing: None,
|
||||
expected: {},
|
||||
label: Some(
|
||||
"deprecated",
|
||||
),
|
||||
},
|
||||
]
|
|
@ -20,7 +20,6 @@ When {
|
|||
},
|
||||
},
|
||||
],
|
||||
guard: None,
|
||||
then: Var {
|
||||
location: 22..26,
|
||||
name: "True",
|
||||
|
|
|
@ -20,7 +20,6 @@ When {
|
|||
},
|
||||
},
|
||||
],
|
||||
guard: None,
|
||||
then: UnOp {
|
||||
op: Negate,
|
||||
location: 22..25,
|
||||
|
@ -44,7 +43,6 @@ When {
|
|||
},
|
||||
},
|
||||
],
|
||||
guard: None,
|
||||
then: UInt {
|
||||
location: 35..37,
|
||||
value: "14",
|
||||
|
|
|
@ -909,30 +909,6 @@ fn exhaustiveness_nested_list_and_tuples() {
|
|||
assert!(check(parse(source_code)).is_ok())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn exhaustiveness_guard() {
|
||||
let source_code = r#"
|
||||
fn foo() {
|
||||
when [(True, 42)] is {
|
||||
[(True, x), ..] if x == 42 -> Void
|
||||
[(False, x), ..] -> Void
|
||||
[] -> Void
|
||||
}
|
||||
}
|
||||
"#;
|
||||
|
||||
assert!(matches!(
|
||||
check(parse(source_code)),
|
||||
Err((
|
||||
_,
|
||||
Error::NotExhaustivePatternMatch {
|
||||
unmatched,
|
||||
..
|
||||
}
|
||||
)) if unmatched[0] == "[(True, _), ..]"
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn expect_sugar_correct_type() {
|
||||
let source_code = r#"
|
||||
|
@ -1183,25 +1159,6 @@ fn list_pattern_3() {
|
|||
|
||||
#[test]
|
||||
fn list_pattern_4() {
|
||||
let source_code = r#"
|
||||
test foo() {
|
||||
let xs = [1, 2, 3]
|
||||
let x = when xs is {
|
||||
[] -> 1
|
||||
[x] -> x
|
||||
[x, ..] if x > 10 -> x
|
||||
}
|
||||
x == 1
|
||||
}
|
||||
"#;
|
||||
assert!(matches!(
|
||||
check(parse(source_code)),
|
||||
Err((_, Error::NotExhaustivePatternMatch { .. }))
|
||||
))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn list_pattern_5() {
|
||||
let source_code = r#"
|
||||
test foo() {
|
||||
let xs = [1, 2, 3]
|
||||
|
@ -1216,7 +1173,7 @@ fn list_pattern_5() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn list_pattern_6() {
|
||||
fn list_pattern_5() {
|
||||
let source_code = r#"
|
||||
test foo() {
|
||||
let xs = [1, 2, 3]
|
||||
|
|
|
@ -504,23 +504,6 @@ If you really meant to return that last expression, try to replace it with the f
|
|||
count: usize,
|
||||
},
|
||||
|
||||
#[error(
|
||||
"I stumbled upon an invalid (non-local) clause guard '{}'.\n",
|
||||
name.if_supports_color(Stdout, |s| s.purple())
|
||||
)]
|
||||
#[diagnostic(url(
|
||||
"https://aiken-lang.org/language-tour/control-flow#checking-equality-and-ordering-in-patterns"
|
||||
))]
|
||||
#[diagnostic(code("illegal::clause_guard"))]
|
||||
#[diagnostic(help(
|
||||
"There are some conditions regarding what can be used in a guard. Values must be either local to the function, or defined as module constants. You can't use functions or records in there."
|
||||
))]
|
||||
NonLocalClauseGuardVariable {
|
||||
#[label]
|
||||
location: Span,
|
||||
name: String,
|
||||
},
|
||||
|
||||
#[error("I tripped over an attempt to access elements on something that isn't indexable.\n")]
|
||||
#[diagnostic(url("https://aiken-lang.org/language-tour/primitive-types#tuples"))]
|
||||
#[diagnostic(code("illegal::indexable"))]
|
||||
|
@ -1065,7 +1048,6 @@ impl ExtraData for Error {
|
|||
| Error::LogicalOpChainMissingExpr { .. }
|
||||
| Error::MissingVarInAlternativePattern { .. }
|
||||
| Error::MultiValidatorEqualArgs { .. }
|
||||
| Error::NonLocalClauseGuardVariable { .. }
|
||||
| Error::NotIndexable { .. }
|
||||
| Error::NotExhaustivePatternMatch { .. }
|
||||
| Error::NotFn { .. }
|
||||
|
|
|
@ -11,12 +11,11 @@ use super::{
|
|||
use crate::{
|
||||
ast::{
|
||||
self, Annotation, ArgName, AssignmentKind, AssignmentPattern, BinOp, Bls12_381Point,
|
||||
ByteArrayFormatPreference, CallArg, ClauseGuard, Constant, Curve, Function, IfBranch,
|
||||
ByteArrayFormatPreference, CallArg, Constant, Curve, Function, IfBranch,
|
||||
LogicalOpChainKind, Pattern, RecordUpdateSpread, Span, TraceKind, TraceLevel, Tracing,
|
||||
TypedArg, TypedCallArg, TypedClause, TypedClauseGuard, TypedIfBranch, TypedPattern,
|
||||
TypedRecordUpdateArg, UnOp, UntypedArg, UntypedAssignmentKind, UntypedClause,
|
||||
UntypedClauseGuard, UntypedFunction, UntypedIfBranch, UntypedPattern,
|
||||
UntypedRecordUpdateArg,
|
||||
TypedArg, TypedCallArg, TypedClause, TypedIfBranch, TypedPattern, TypedRecordUpdateArg,
|
||||
UnOp, UntypedArg, UntypedAssignmentKind, UntypedClause, UntypedFunction, UntypedIfBranch,
|
||||
UntypedPattern, UntypedRecordUpdateArg,
|
||||
},
|
||||
builtins::{
|
||||
bool, byte_array, data, from_default_function, function, g1_element, g2_element, int, list,
|
||||
|
@ -259,14 +258,7 @@ impl<'a, 'b> ExprTyper<'a, 'b> {
|
|||
// for clauses that don't have guards.
|
||||
let mut patterns = Vec::new();
|
||||
for clause in typed_clauses {
|
||||
if let TypedClause {
|
||||
guard: None,
|
||||
pattern,
|
||||
..
|
||||
} = clause
|
||||
{
|
||||
patterns.push(pattern)
|
||||
}
|
||||
patterns.push(&clause.pattern);
|
||||
}
|
||||
|
||||
self.environment
|
||||
|
@ -1398,21 +1390,18 @@ impl<'a, 'b> ExprTyper<'a, 'b> {
|
|||
) -> Result<Vec<TypedClause>, Error> {
|
||||
let UntypedClause {
|
||||
patterns,
|
||||
guard,
|
||||
then,
|
||||
location,
|
||||
} = clause;
|
||||
|
||||
let (guard, then, typed_patterns) = self.in_new_scope(|scope| {
|
||||
let (then, typed_patterns) = self.in_new_scope(|scope| {
|
||||
let typed_patterns = scope.infer_clause_pattern(patterns, subject, &location)?;
|
||||
|
||||
let guard = scope.infer_optional_clause_guard(guard)?;
|
||||
|
||||
assert_no_assignment(&then)?;
|
||||
|
||||
let then = scope.infer(then)?;
|
||||
|
||||
Ok::<_, Error>((guard, then, typed_patterns))
|
||||
Ok::<_, Error>((then, typed_patterns))
|
||||
})?;
|
||||
|
||||
Ok(typed_patterns
|
||||
|
@ -1420,219 +1409,11 @@ impl<'a, 'b> ExprTyper<'a, 'b> {
|
|||
.map(|pattern| TypedClause {
|
||||
location,
|
||||
pattern,
|
||||
guard: guard.clone(),
|
||||
then: then.clone(),
|
||||
})
|
||||
.collect())
|
||||
}
|
||||
|
||||
fn infer_clause_guard(&mut self, guard: UntypedClauseGuard) -> Result<TypedClauseGuard, Error> {
|
||||
match guard {
|
||||
ClauseGuard::Var { location, name, .. } => {
|
||||
let constructor = self.infer_value_constructor(&None, &name, &location)?;
|
||||
|
||||
// We cannot support all values in guard expressions as the BEAM does not
|
||||
match &constructor.variant {
|
||||
ValueConstructorVariant::LocalVariable { .. } => (),
|
||||
|
||||
ValueConstructorVariant::ModuleFn { .. }
|
||||
| ValueConstructorVariant::Record { .. } => {
|
||||
return Err(Error::NonLocalClauseGuardVariable { location, name });
|
||||
}
|
||||
|
||||
ValueConstructorVariant::ModuleConstant { literal, .. } => {
|
||||
return Ok(ClauseGuard::Constant(literal.clone()));
|
||||
}
|
||||
};
|
||||
|
||||
Ok(ClauseGuard::Var {
|
||||
location,
|
||||
name,
|
||||
tipo: constructor.tipo,
|
||||
})
|
||||
}
|
||||
|
||||
ClauseGuard::Not {
|
||||
location, value, ..
|
||||
} => {
|
||||
let value = self.infer_clause_guard(*value)?;
|
||||
|
||||
self.unify(bool(), value.tipo(), value.location(), false)?;
|
||||
|
||||
Ok(ClauseGuard::Not {
|
||||
location,
|
||||
value: Box::new(value),
|
||||
})
|
||||
}
|
||||
|
||||
ClauseGuard::And {
|
||||
location,
|
||||
left,
|
||||
right,
|
||||
..
|
||||
} => {
|
||||
let left = self.infer_clause_guard(*left)?;
|
||||
|
||||
self.unify(bool(), left.tipo(), left.location(), false)?;
|
||||
|
||||
let right = self.infer_clause_guard(*right)?;
|
||||
|
||||
self.unify(bool(), right.tipo(), right.location(), false)?;
|
||||
|
||||
Ok(ClauseGuard::And {
|
||||
location,
|
||||
left: Box::new(left),
|
||||
right: Box::new(right),
|
||||
})
|
||||
}
|
||||
|
||||
ClauseGuard::Or {
|
||||
location,
|
||||
left,
|
||||
right,
|
||||
..
|
||||
} => {
|
||||
let left = self.infer_clause_guard(*left)?;
|
||||
|
||||
self.unify(bool(), left.tipo(), left.location(), false)?;
|
||||
|
||||
let right = self.infer_clause_guard(*right)?;
|
||||
|
||||
self.unify(bool(), right.tipo(), right.location(), false)?;
|
||||
|
||||
Ok(ClauseGuard::Or {
|
||||
location,
|
||||
left: Box::new(left),
|
||||
right: Box::new(right),
|
||||
})
|
||||
}
|
||||
|
||||
ClauseGuard::Equals {
|
||||
location,
|
||||
left,
|
||||
right,
|
||||
..
|
||||
} => {
|
||||
let left = self.infer_clause_guard(*left)?;
|
||||
let right = self.infer_clause_guard(*right)?;
|
||||
|
||||
self.unify(left.tipo(), right.tipo(), location, false)?;
|
||||
|
||||
Ok(ClauseGuard::Equals {
|
||||
location,
|
||||
left: Box::new(left),
|
||||
right: Box::new(right),
|
||||
})
|
||||
}
|
||||
|
||||
ClauseGuard::NotEquals {
|
||||
location,
|
||||
left,
|
||||
right,
|
||||
..
|
||||
} => {
|
||||
let left = self.infer_clause_guard(*left)?;
|
||||
let right = self.infer_clause_guard(*right)?;
|
||||
|
||||
self.unify(left.tipo(), right.tipo(), location, false)?;
|
||||
|
||||
Ok(ClauseGuard::NotEquals {
|
||||
location,
|
||||
left: Box::new(left),
|
||||
right: Box::new(right),
|
||||
})
|
||||
}
|
||||
|
||||
ClauseGuard::GtInt {
|
||||
location,
|
||||
left,
|
||||
right,
|
||||
..
|
||||
} => {
|
||||
let left = self.infer_clause_guard(*left)?;
|
||||
|
||||
self.unify(int(), left.tipo(), left.location(), false)?;
|
||||
|
||||
let right = self.infer_clause_guard(*right)?;
|
||||
|
||||
self.unify(int(), right.tipo(), right.location(), false)?;
|
||||
|
||||
Ok(ClauseGuard::GtInt {
|
||||
location,
|
||||
left: Box::new(left),
|
||||
right: Box::new(right),
|
||||
})
|
||||
}
|
||||
|
||||
ClauseGuard::GtEqInt {
|
||||
location,
|
||||
left,
|
||||
right,
|
||||
..
|
||||
} => {
|
||||
let left = self.infer_clause_guard(*left)?;
|
||||
|
||||
self.unify(int(), left.tipo(), left.location(), false)?;
|
||||
|
||||
let right = self.infer_clause_guard(*right)?;
|
||||
|
||||
self.unify(int(), right.tipo(), right.location(), false)?;
|
||||
|
||||
Ok(ClauseGuard::GtEqInt {
|
||||
location,
|
||||
left: Box::new(left),
|
||||
right: Box::new(right),
|
||||
})
|
||||
}
|
||||
|
||||
ClauseGuard::LtInt {
|
||||
location,
|
||||
left,
|
||||
right,
|
||||
..
|
||||
} => {
|
||||
let left = self.infer_clause_guard(*left)?;
|
||||
|
||||
self.unify(int(), left.tipo(), left.location(), false)?;
|
||||
|
||||
let right = self.infer_clause_guard(*right)?;
|
||||
|
||||
self.unify(int(), right.tipo(), right.location(), false)?;
|
||||
|
||||
Ok(ClauseGuard::LtInt {
|
||||
location,
|
||||
left: Box::new(left),
|
||||
right: Box::new(right),
|
||||
})
|
||||
}
|
||||
|
||||
ClauseGuard::LtEqInt {
|
||||
location,
|
||||
left,
|
||||
right,
|
||||
..
|
||||
} => {
|
||||
let left = self.infer_clause_guard(*left)?;
|
||||
|
||||
self.unify(int(), left.tipo(), left.location(), false)?;
|
||||
|
||||
let right = self.infer_clause_guard(*right)?;
|
||||
|
||||
self.unify(int(), right.tipo(), right.location(), false)?;
|
||||
|
||||
Ok(ClauseGuard::LtEqInt {
|
||||
location,
|
||||
left: Box::new(left),
|
||||
right: Box::new(right),
|
||||
})
|
||||
}
|
||||
|
||||
ClauseGuard::Constant(constant) => {
|
||||
self.infer_const(&None, constant).map(ClauseGuard::Constant)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn infer_clause_pattern(
|
||||
&mut self,
|
||||
patterns: Vec1<UntypedPattern>,
|
||||
|
@ -1963,25 +1744,6 @@ impl<'a, 'b> ExprTyper<'a, 'b> {
|
|||
})
|
||||
}
|
||||
|
||||
fn infer_optional_clause_guard(
|
||||
&mut self,
|
||||
guard: Option<UntypedClauseGuard>,
|
||||
) -> Result<Option<TypedClauseGuard>, Error> {
|
||||
match guard {
|
||||
// If there is no guard we do nothing
|
||||
None => Ok(None),
|
||||
|
||||
// If there is a guard we assert that it is of type Bool
|
||||
Some(guard) => {
|
||||
let guard = self.infer_clause_guard(guard)?;
|
||||
|
||||
self.unify(bool(), guard.tipo(), guard.location(), false)?;
|
||||
|
||||
Ok(Some(guard))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn infer_logical_op_chain(
|
||||
&mut self,
|
||||
kind: LogicalOpChainKind,
|
||||
|
|
|
@ -5540,562 +5540,8 @@ fn test_init_3() {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn list_clause_with_guard() {
|
||||
let src = r#"
|
||||
fn do_init(self: List<Int>) -> List<Int> {
|
||||
when self is {
|
||||
[] -> fail @"unreachable"
|
||||
[_] ->
|
||||
[]
|
||||
[a, x] if x > 2 -> {
|
||||
[a]
|
||||
}
|
||||
[a, b] -> []
|
||||
[a, b, ..c] -> {
|
||||
c
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
test init_3() {
|
||||
do_init([1, 3]) == [1]
|
||||
}
|
||||
"#;
|
||||
|
||||
assert_uplc(
|
||||
src,
|
||||
Term::equals_data()
|
||||
.apply(
|
||||
Term::list_data().apply(
|
||||
Term::var("do_init")
|
||||
.lambda("do_init")
|
||||
.apply(
|
||||
Term::var("self")
|
||||
.delayed_choose_list(
|
||||
Term::Error.delayed_trace(Term::string("unreachable")),
|
||||
Term::var("tail_1")
|
||||
.delayed_choose_list(
|
||||
Term::empty_list(),
|
||||
Term::var("tail_2")
|
||||
.choose_list(
|
||||
Term::var("clause_guard")
|
||||
.if_then_else(
|
||||
Term::mk_cons()
|
||||
.apply(
|
||||
Term::i_data()
|
||||
.apply(Term::var("a")),
|
||||
)
|
||||
.apply(Term::empty_list())
|
||||
.delay(),
|
||||
Term::var("clauses_delayed"),
|
||||
)
|
||||
.force()
|
||||
.lambda("clause_guard")
|
||||
.apply(
|
||||
Term::less_than_integer()
|
||||
.apply(Term::integer(2.into()))
|
||||
.apply(Term::var("x")),
|
||||
)
|
||||
.lambda("x")
|
||||
.apply(
|
||||
Term::un_i_data().apply(
|
||||
Term::head_list()
|
||||
.apply(Term::var("tail_1")),
|
||||
),
|
||||
)
|
||||
.lambda("a")
|
||||
.apply(
|
||||
Term::un_i_data().apply(
|
||||
Term::head_list()
|
||||
.apply(Term::var("self")),
|
||||
),
|
||||
)
|
||||
.delay(),
|
||||
Term::var("clauses_delayed"),
|
||||
)
|
||||
.force()
|
||||
.lambda("clauses_delayed")
|
||||
.apply(
|
||||
Term::var("tail_2")
|
||||
.delayed_choose_list(
|
||||
Term::empty_list()
|
||||
.lambda("b")
|
||||
.apply(
|
||||
Term::un_i_data().apply(
|
||||
Term::head_list().apply(
|
||||
Term::var("tail_1"),
|
||||
),
|
||||
),
|
||||
)
|
||||
.lambda("a")
|
||||
.apply(
|
||||
Term::un_i_data().apply(
|
||||
Term::head_list().apply(
|
||||
Term::var("self"),
|
||||
),
|
||||
),
|
||||
),
|
||||
Term::var("c").lambda("c").apply(
|
||||
Term::tail_list()
|
||||
.apply(Term::var("tail_1"))
|
||||
.lambda("b")
|
||||
.apply(Term::un_i_data().apply(
|
||||
Term::head_list().apply(
|
||||
Term::var("tail_1"),
|
||||
),
|
||||
))
|
||||
.lambda("a")
|
||||
.apply(
|
||||
Term::un_i_data().apply(
|
||||
Term::head_list()
|
||||
.apply(Term::var(
|
||||
"self",
|
||||
)),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
.delay(),
|
||||
)
|
||||
.lambda("tail_2")
|
||||
.apply(
|
||||
Term::tail_list().apply(Term::var("tail_1")),
|
||||
),
|
||||
)
|
||||
.lambda("tail_1")
|
||||
.apply(Term::tail_list().apply(Term::var("self"))),
|
||||
)
|
||||
.lambda("self"),
|
||||
)
|
||||
.apply(Term::list_values(vec![
|
||||
Constant::Data(Data::integer(1.into())),
|
||||
Constant::Data(Data::integer(3.into())),
|
||||
])),
|
||||
),
|
||||
)
|
||||
.apply(Term::data(Data::list(vec![Data::integer(1.into())]))),
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn list_clause_with_guard2() {
|
||||
let src = r#"
|
||||
fn do_init(self: List<Int>) -> List<Int> {
|
||||
when self is {
|
||||
[] -> fail @"unreachable"
|
||||
[_] ->
|
||||
[]
|
||||
[a, x] -> {
|
||||
[a]
|
||||
}
|
||||
[a] if a > 10 -> []
|
||||
[a, b, ..c] -> {
|
||||
c
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
test init_3() {
|
||||
do_init([1, 3]) == [1]
|
||||
}
|
||||
"#;
|
||||
|
||||
assert_uplc(
|
||||
src,
|
||||
Term::equals_data()
|
||||
.apply(
|
||||
Term::list_data().apply(
|
||||
Term::var("do_init")
|
||||
.lambda("do_init")
|
||||
.apply(
|
||||
Term::var("self")
|
||||
.delayed_choose_list(
|
||||
Term::Error.delayed_trace(Term::string("unreachable")),
|
||||
Term::var("tail_1")
|
||||
.delayed_choose_list(
|
||||
Term::empty_list(),
|
||||
Term::var("tail_1")
|
||||
.choose_list(
|
||||
Term::var("clause_guard")
|
||||
.if_then_else(
|
||||
Term::empty_list().delay(),
|
||||
Term::var("clauses_delayed"),
|
||||
)
|
||||
.force()
|
||||
.lambda("clause_guard")
|
||||
.apply(
|
||||
Term::less_than_integer()
|
||||
.apply(Term::integer(10.into()))
|
||||
.apply(Term::var("a")),
|
||||
)
|
||||
.lambda("a")
|
||||
.apply(
|
||||
Term::un_i_data().apply(
|
||||
Term::head_list()
|
||||
.apply(Term::var("self")),
|
||||
),
|
||||
)
|
||||
.delay(),
|
||||
Term::var("clauses_delayed"),
|
||||
)
|
||||
.force()
|
||||
.lambda("clauses_delayed")
|
||||
.apply(
|
||||
Term::var("tail_2")
|
||||
.delayed_choose_list(
|
||||
Term::mk_cons()
|
||||
.apply(
|
||||
Term::i_data()
|
||||
.apply(Term::var("a")),
|
||||
)
|
||||
.apply(Term::empty_list())
|
||||
.lambda("x")
|
||||
.apply(
|
||||
Term::un_i_data().apply(
|
||||
Term::head_list().apply(
|
||||
Term::var("tail_1"),
|
||||
),
|
||||
),
|
||||
)
|
||||
.lambda("a")
|
||||
.apply(
|
||||
Term::un_i_data().apply(
|
||||
Term::head_list().apply(
|
||||
Term::var("self"),
|
||||
),
|
||||
),
|
||||
),
|
||||
Term::var("c").lambda("c").apply(
|
||||
Term::tail_list()
|
||||
.apply(Term::var("tail_1"))
|
||||
.lambda("b")
|
||||
.apply(Term::un_i_data().apply(
|
||||
Term::head_list().apply(
|
||||
Term::var("tail_1"),
|
||||
),
|
||||
))
|
||||
.lambda("a")
|
||||
.apply(
|
||||
Term::un_i_data().apply(
|
||||
Term::head_list()
|
||||
.apply(Term::var(
|
||||
"self",
|
||||
)),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
.lambda("tail_2")
|
||||
.apply(
|
||||
Term::tail_list()
|
||||
.apply(Term::var("tail_1")),
|
||||
)
|
||||
.delay(),
|
||||
),
|
||||
)
|
||||
.lambda("tail_1")
|
||||
.apply(Term::tail_list().apply(Term::var("self"))),
|
||||
)
|
||||
.lambda("self"),
|
||||
)
|
||||
.apply(Term::list_values(vec![
|
||||
Constant::Data(Data::integer(1.into())),
|
||||
Constant::Data(Data::integer(3.into())),
|
||||
])),
|
||||
),
|
||||
)
|
||||
.apply(Term::data(Data::list(vec![Data::integer(1.into())]))),
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn list_clause_with_guard3() {
|
||||
let src = r#"
|
||||
fn do_init(self: List<Int>) -> List<Int> {
|
||||
when self is {
|
||||
[] -> fail @"unreachable"
|
||||
[_] ->
|
||||
[]
|
||||
[a, x] -> {
|
||||
[a]
|
||||
}
|
||||
[a, ..g] if a > 10 -> g
|
||||
[a, b, ..c] -> {
|
||||
c
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
test init_3() {
|
||||
do_init([1, 3]) == [1]
|
||||
}
|
||||
"#;
|
||||
|
||||
assert_uplc(
|
||||
src,
|
||||
Term::equals_data()
|
||||
.apply(
|
||||
Term::list_data().apply(
|
||||
Term::var("do_init")
|
||||
.lambda("do_init")
|
||||
.apply(
|
||||
Term::var("self")
|
||||
.delayed_choose_list(
|
||||
Term::Error.delayed_trace(Term::string("unreachable")),
|
||||
Term::var("tail_1")
|
||||
.delayed_choose_list(
|
||||
Term::empty_list(),
|
||||
Term::var("self")
|
||||
.choose_list(
|
||||
Term::var("clause_guard")
|
||||
.if_then_else(
|
||||
Term::var("g").delay(),
|
||||
Term::var("clauses_delayed"),
|
||||
)
|
||||
.force()
|
||||
.lambda("clause_guard")
|
||||
.apply(
|
||||
Term::less_than_integer()
|
||||
.apply(Term::integer(10.into()))
|
||||
.apply(Term::var("a")),
|
||||
)
|
||||
.lambda("g")
|
||||
.apply(
|
||||
Term::tail_list()
|
||||
.apply(Term::var("self")),
|
||||
)
|
||||
.lambda("a")
|
||||
.apply(
|
||||
Term::un_i_data().apply(
|
||||
Term::head_list()
|
||||
.apply(Term::var("self")),
|
||||
),
|
||||
)
|
||||
.delay(),
|
||||
Term::var("clauses_delayed"),
|
||||
)
|
||||
.force()
|
||||
.lambda("clauses_delayed")
|
||||
.apply(
|
||||
Term::var("tail_2")
|
||||
.delayed_choose_list(
|
||||
Term::mk_cons()
|
||||
.apply(
|
||||
Term::i_data()
|
||||
.apply(Term::var("a")),
|
||||
)
|
||||
.apply(Term::empty_list())
|
||||
.lambda("x")
|
||||
.apply(
|
||||
Term::un_i_data().apply(
|
||||
Term::head_list().apply(
|
||||
Term::var("tail_1"),
|
||||
),
|
||||
),
|
||||
)
|
||||
.lambda("a")
|
||||
.apply(
|
||||
Term::un_i_data().apply(
|
||||
Term::head_list().apply(
|
||||
Term::var("self"),
|
||||
),
|
||||
),
|
||||
),
|
||||
Term::var("c").lambda("c").apply(
|
||||
Term::tail_list()
|
||||
.apply(Term::var("tail_1"))
|
||||
.lambda("b")
|
||||
.apply(Term::un_i_data().apply(
|
||||
Term::head_list().apply(
|
||||
Term::var("tail_1"),
|
||||
),
|
||||
))
|
||||
.lambda("a")
|
||||
.apply(
|
||||
Term::un_i_data().apply(
|
||||
Term::head_list()
|
||||
.apply(Term::var(
|
||||
"self",
|
||||
)),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
.lambda("tail_2")
|
||||
.apply(
|
||||
Term::tail_list()
|
||||
.apply(Term::var("tail_1")),
|
||||
)
|
||||
.delay(),
|
||||
),
|
||||
)
|
||||
.lambda("tail_1")
|
||||
.apply(Term::tail_list().apply(Term::var("self"))),
|
||||
)
|
||||
.lambda("self"),
|
||||
)
|
||||
.apply(Term::list_values(vec![
|
||||
Constant::Data(Data::integer(1.into())),
|
||||
Constant::Data(Data::integer(3.into())),
|
||||
])),
|
||||
),
|
||||
)
|
||||
.apply(Term::data(Data::list(vec![Data::integer(1.into())]))),
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn list_clause_with_assign() {
|
||||
let src = r#"
|
||||
fn do_init(self: List<Int>) -> List<Int> {
|
||||
when self is {
|
||||
[] -> fail @"unreachable"
|
||||
[_] as a ->
|
||||
a
|
||||
[a, x] if x > 2 -> {
|
||||
[a]
|
||||
}
|
||||
[a, x] -> {
|
||||
[x]
|
||||
}
|
||||
[a, b, ..c] -> {
|
||||
c
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
test init_3() {
|
||||
do_init([1, 3]) == [1]
|
||||
}
|
||||
"#;
|
||||
|
||||
assert_uplc(
|
||||
src,
|
||||
Term::equals_data()
|
||||
.apply(
|
||||
Term::list_data().apply(
|
||||
Term::var("do_init")
|
||||
.lambda("do_init")
|
||||
.apply(
|
||||
Term::var("self")
|
||||
.delayed_choose_list(
|
||||
Term::Error.delayed_trace(Term::string("unreachable")),
|
||||
Term::var("tail_1")
|
||||
.delayed_choose_list(
|
||||
Term::var("self"),
|
||||
Term::var("tail_2")
|
||||
.choose_list(
|
||||
Term::var("clause_guard")
|
||||
.if_then_else(
|
||||
Term::mk_cons()
|
||||
.apply(
|
||||
Term::i_data()
|
||||
.apply(Term::var("a")),
|
||||
)
|
||||
.apply(Term::empty_list())
|
||||
.delay(),
|
||||
Term::var("clauses_delayed"),
|
||||
)
|
||||
.force()
|
||||
.lambda("clause_guard")
|
||||
.apply(
|
||||
Term::less_than_integer()
|
||||
.apply(Term::integer(2.into()))
|
||||
.apply(Term::var("x")),
|
||||
)
|
||||
.lambda("x")
|
||||
.apply(
|
||||
Term::un_i_data().apply(
|
||||
Term::head_list()
|
||||
.apply(Term::var("tail_1")),
|
||||
),
|
||||
)
|
||||
.lambda("a")
|
||||
.apply(
|
||||
Term::un_i_data().apply(
|
||||
Term::head_list()
|
||||
.apply(Term::var("self")),
|
||||
),
|
||||
)
|
||||
.delay(),
|
||||
Term::var("clauses_delayed"),
|
||||
)
|
||||
.force()
|
||||
.lambda("clauses_delayed")
|
||||
.apply(
|
||||
Term::var("tail_2")
|
||||
.delayed_choose_list(
|
||||
Term::mk_cons()
|
||||
.apply(
|
||||
Term::i_data()
|
||||
.apply(Term::var("x")),
|
||||
)
|
||||
.apply(Term::empty_list())
|
||||
.lambda("x")
|
||||
.apply(
|
||||
Term::un_i_data().apply(
|
||||
Term::head_list().apply(
|
||||
Term::var("tail_1"),
|
||||
),
|
||||
),
|
||||
)
|
||||
.lambda("a")
|
||||
.apply(
|
||||
Term::un_i_data().apply(
|
||||
Term::head_list().apply(
|
||||
Term::var("self"),
|
||||
),
|
||||
),
|
||||
),
|
||||
Term::var("c").lambda("c").apply(
|
||||
Term::tail_list()
|
||||
.apply(Term::var("tail_1"))
|
||||
.lambda("b")
|
||||
.apply(Term::un_i_data().apply(
|
||||
Term::head_list().apply(
|
||||
Term::var("tail_1"),
|
||||
),
|
||||
))
|
||||
.lambda("a")
|
||||
.apply(
|
||||
Term::un_i_data().apply(
|
||||
Term::head_list()
|
||||
.apply(Term::var(
|
||||
"self",
|
||||
)),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
.delay(),
|
||||
)
|
||||
.lambda("tail_2")
|
||||
.apply(
|
||||
Term::tail_list().apply(Term::var("tail_1")),
|
||||
),
|
||||
)
|
||||
.lambda("tail_1")
|
||||
.apply(Term::tail_list().apply(Term::var("self"))),
|
||||
)
|
||||
.lambda("self"),
|
||||
)
|
||||
.apply(Term::list_values(vec![
|
||||
Constant::Data(Data::integer(1.into())),
|
||||
Constant::Data(Data::integer(3.into())),
|
||||
])),
|
||||
),
|
||||
)
|
||||
.apply(Term::data(Data::list(vec![Data::integer(1.into())]))),
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn list_clause_with_assign2() {
|
||||
let src = r#"
|
||||
fn do_init(self: List<Option<Int>>) -> List<Option<Int>> {
|
||||
when self is {
|
||||
|
|
|
@ -13,4 +13,4 @@ requirements = []
|
|||
source = "github"
|
||||
|
||||
[etags]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1721831083, nanos_since_epoch = 877044000 }, "a746f5b5cd3c2ca5dc19c43bcfc64230c546fafea2ba5f8e340c227b85886078"]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1722524440, nanos_since_epoch = 926316000 }, "ba17f973dcfbcb106f8fef361283ad424830a5cf5986a386e4e61dd98a99e5c8"]
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"plutusVersion": "v2",
|
||||
"compiler": {
|
||||
"name": "Aiken",
|
||||
"version": "v1.0.29-alpha+dfce9c1"
|
||||
"version": "v1.0.31-alpha+896cec4"
|
||||
}
|
||||
},
|
||||
"validators": [
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"plutusVersion": "v2",
|
||||
"compiler": {
|
||||
"name": "Aiken",
|
||||
"version": "v1.0.29-alpha+dfce9c1"
|
||||
"version": "v1.0.31-alpha+896cec4"
|
||||
}
|
||||
},
|
||||
"validators": [
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
# This file was generated by Aiken
|
||||
# You typically do not need to edit this file
|
||||
|
||||
requirements = []
|
||||
packages = []
|
||||
|
||||
[etags]
|
|
@ -1,3 +0,0 @@
|
|||
name = 'aiken-lang/acceptance_test_048'
|
||||
version = '0.0.0'
|
||||
description = ''
|
|
@ -1,62 +0,0 @@
|
|||
test foo_1() {
|
||||
let a = False
|
||||
when a is {
|
||||
a if a -> False
|
||||
_ -> True
|
||||
}
|
||||
}
|
||||
|
||||
test foo_2() {
|
||||
let point = (14, 42)
|
||||
when point is {
|
||||
(x, _) if x > 100 -> False
|
||||
(x, _) if x > 10 -> True
|
||||
_ -> False
|
||||
}
|
||||
}
|
||||
|
||||
test foo_3() {
|
||||
let point = (14, 42)
|
||||
when point is {
|
||||
(x, y) if x == 14 && y <= 100 -> True
|
||||
_ -> False
|
||||
}
|
||||
}
|
||||
|
||||
test foo_4() {
|
||||
let a = False
|
||||
let point = (14, 42)
|
||||
when point is {
|
||||
(x, y) if !a -> x + y == 56
|
||||
_ -> False
|
||||
}
|
||||
}
|
||||
|
||||
type Seasons {
|
||||
Winter
|
||||
Spring
|
||||
Summer
|
||||
Fall
|
||||
}
|
||||
|
||||
fn is_cold(season, hour) {
|
||||
when season is {
|
||||
Winter | Fall -> True
|
||||
_ if hour >= 18 -> True
|
||||
_ -> False
|
||||
}
|
||||
}
|
||||
|
||||
test foo_5() {
|
||||
!is_cold(Spring, 15) && is_cold(Summer, 22)
|
||||
}
|
||||
|
||||
fn when_tuple(a: (Int, Int)) -> Int {
|
||||
when a is {
|
||||
(a, _b) -> a
|
||||
}
|
||||
}
|
||||
|
||||
test foo_6() {
|
||||
when_tuple((4, 1)) == 4
|
||||
}
|
|
@ -13,4 +13,4 @@ requirements = []
|
|||
source = "github"
|
||||
|
||||
[etags]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1721831081, nanos_since_epoch = 901928000 }, "a746f5b5cd3c2ca5dc19c43bcfc64230c546fafea2ba5f8e340c227b85886078"]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1722524446, nanos_since_epoch = 783414000 }, "ba17f973dcfbcb106f8fef361283ad424830a5cf5986a386e4e61dd98a99e5c8"]
|
||||
|
|
|
@ -13,4 +13,4 @@ requirements = []
|
|||
source = "github"
|
||||
|
||||
[etags]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1721831083, nanos_since_epoch = 434512000 }, "a746f5b5cd3c2ca5dc19c43bcfc64230c546fafea2ba5f8e340c227b85886078"]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1722524441, nanos_since_epoch = 149450000 }, "ba17f973dcfbcb106f8fef361283ad424830a5cf5986a386e4e61dd98a99e5c8"]
|
||||
|
|
|
@ -13,4 +13,4 @@ requirements = []
|
|||
source = "github"
|
||||
|
||||
[etags]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1721831249, nanos_since_epoch = 124849000 }, "a746f5b5cd3c2ca5dc19c43bcfc64230c546fafea2ba5f8e340c227b85886078"]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1722524444, nanos_since_epoch = 386446000 }, "ba17f973dcfbcb106f8fef361283ad424830a5cf5986a386e4e61dd98a99e5c8"]
|
||||
|
|
|
@ -13,4 +13,4 @@ requirements = []
|
|||
source = "github"
|
||||
|
||||
[etags]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1721831084, nanos_since_epoch = 29892000 }, "a746f5b5cd3c2ca5dc19c43bcfc64230c546fafea2ba5f8e340c227b85886078"]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1722524442, nanos_since_epoch = 382616000 }, "ba17f973dcfbcb106f8fef361283ad424830a5cf5986a386e4e61dd98a99e5c8"]
|
||||
|
|
|
@ -13,4 +13,4 @@ requirements = []
|
|||
source = "github"
|
||||
|
||||
[etags]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1721831251, nanos_since_epoch = 240824000 }, "a746f5b5cd3c2ca5dc19c43bcfc64230c546fafea2ba5f8e340c227b85886078"]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1722524440, nanos_since_epoch = 769946000 }, "ba17f973dcfbcb106f8fef361283ad424830a5cf5986a386e4e61dd98a99e5c8"]
|
||||
|
|
|
@ -13,4 +13,4 @@ requirements = []
|
|||
source = "github"
|
||||
|
||||
[etags]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1721831249, nanos_since_epoch = 836798000 }, "a746f5b5cd3c2ca5dc19c43bcfc64230c546fafea2ba5f8e340c227b85886078"]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1722524443, nanos_since_epoch = 507530000 }, "ba17f973dcfbcb106f8fef361283ad424830a5cf5986a386e4e61dd98a99e5c8"]
|
||||
|
|
|
@ -13,4 +13,4 @@ requirements = []
|
|||
source = "github"
|
||||
|
||||
[etags]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1721831251, nanos_since_epoch = 15898000 }, "a746f5b5cd3c2ca5dc19c43bcfc64230c546fafea2ba5f8e340c227b85886078"]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1722524440, nanos_since_epoch = 774558000 }, "ba17f973dcfbcb106f8fef361283ad424830a5cf5986a386e4e61dd98a99e5c8"]
|
||||
|
|
|
@ -13,4 +13,4 @@ requirements = []
|
|||
source = "github"
|
||||
|
||||
[etags]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1721831079, nanos_since_epoch = 22817000 }, "a746f5b5cd3c2ca5dc19c43bcfc64230c546fafea2ba5f8e340c227b85886078"]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1722524440, nanos_since_epoch = 786194000 }, "ba17f973dcfbcb106f8fef361283ad424830a5cf5986a386e4e61dd98a99e5c8"]
|
||||
|
|
|
@ -13,4 +13,4 @@ requirements = []
|
|||
source = "github"
|
||||
|
||||
[etags]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1721831080, nanos_since_epoch = 166130000 }, "a746f5b5cd3c2ca5dc19c43bcfc64230c546fafea2ba5f8e340c227b85886078"]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1722524444, nanos_since_epoch = 45578000 }, "ba17f973dcfbcb106f8fef361283ad424830a5cf5986a386e4e61dd98a99e5c8"]
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"plutusVersion": "v2",
|
||||
"compiler": {
|
||||
"name": "Aiken",
|
||||
"version": "v1.0.29-alpha+dfce9c1"
|
||||
"version": "v1.0.31-alpha+896cec4"
|
||||
}
|
||||
},
|
||||
"validators": [
|
||||
|
|
|
@ -13,4 +13,4 @@ requirements = []
|
|||
source = "github"
|
||||
|
||||
[etags]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1721831095, nanos_since_epoch = 72131000 }, "a746f5b5cd3c2ca5dc19c43bcfc64230c546fafea2ba5f8e340c227b85886078"]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1722524444, nanos_since_epoch = 430578000 }, "ba17f973dcfbcb106f8fef361283ad424830a5cf5986a386e4e61dd98a99e5c8"]
|
||||
|
|
|
@ -13,4 +13,4 @@ requirements = []
|
|||
source = "github"
|
||||
|
||||
[etags]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1721828369, nanos_since_epoch = 230591000 }, "a746f5b5cd3c2ca5dc19c43bcfc64230c546fafea2ba5f8e340c227b85886078"]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1722524442, nanos_since_epoch = 809682000 }, "ba17f973dcfbcb106f8fef361283ad424830a5cf5986a386e4e61dd98a99e5c8"]
|
||||
|
|
|
@ -13,4 +13,4 @@ requirements = []
|
|||
source = "github"
|
||||
|
||||
[etags]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1721831093, nanos_since_epoch = 975977000 }, "a746f5b5cd3c2ca5dc19c43bcfc64230c546fafea2ba5f8e340c227b85886078"]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1722524446, nanos_since_epoch = 229263000 }, "ba17f973dcfbcb106f8fef361283ad424830a5cf5986a386e4e61dd98a99e5c8"]
|
||||
|
|
|
@ -13,4 +13,4 @@ requirements = []
|
|||
source = "github"
|
||||
|
||||
[etags]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1721828402, nanos_since_epoch = 276492000 }, "a746f5b5cd3c2ca5dc19c43bcfc64230c546fafea2ba5f8e340c227b85886078"]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1722524444, nanos_since_epoch = 430528000 }, "ba17f973dcfbcb106f8fef361283ad424830a5cf5986a386e4e61dd98a99e5c8"]
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"plutusVersion": "v2",
|
||||
"compiler": {
|
||||
"name": "Aiken",
|
||||
"version": "v1.0.29-alpha+dfce9c1"
|
||||
"version": "v1.0.31-alpha+896cec4"
|
||||
}
|
||||
},
|
||||
"validators": [
|
||||
|
|
|
@ -26,9 +26,7 @@ test is_work_2() {
|
|||
fn is_happy_hour(day: DayOfTheWeek, current_time: Int) {
|
||||
when day is {
|
||||
Monday | Sunday -> True
|
||||
Tuesday | Wednesday | Thursday | Friday | Saturday if current_time > 18 ->
|
||||
True
|
||||
_ -> False
|
||||
Tuesday | Wednesday | Thursday | Friday | Saturday -> current_time > 18
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"plutusVersion": "v2",
|
||||
"compiler": {
|
||||
"name": "Aiken",
|
||||
"version": "v1.0.29-alpha+dfce9c1"
|
||||
"version": "v1.0.31-alpha+896cec4"
|
||||
}
|
||||
},
|
||||
"validators": [
|
||||
|
|
|
@ -13,4 +13,4 @@ requirements = []
|
|||
source = "github"
|
||||
|
||||
[etags]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1721831080, nanos_since_epoch = 128414000 }, "a746f5b5cd3c2ca5dc19c43bcfc64230c546fafea2ba5f8e340c227b85886078"]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1722524446, nanos_since_epoch = 229317000 }, "ba17f973dcfbcb106f8fef361283ad424830a5cf5986a386e4e61dd98a99e5c8"]
|
||||
|
|
|
@ -13,4 +13,4 @@ requirements = []
|
|||
source = "github"
|
||||
|
||||
[etags]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1721831078, nanos_since_epoch = 14872000 }, "a746f5b5cd3c2ca5dc19c43bcfc64230c546fafea2ba5f8e340c227b85886078"]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1722524442, nanos_since_epoch = 806628000 }, "ba17f973dcfbcb106f8fef361283ad424830a5cf5986a386e4e61dd98a99e5c8"]
|
||||
|
|
|
@ -13,4 +13,4 @@ requirements = []
|
|||
source = "github"
|
||||
|
||||
[etags]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1721831078, nanos_since_epoch = 395639000 }, "a746f5b5cd3c2ca5dc19c43bcfc64230c546fafea2ba5f8e340c227b85886078"]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1722524442, nanos_since_epoch = 809656000 }, "ba17f973dcfbcb106f8fef361283ad424830a5cf5986a386e4e61dd98a99e5c8"]
|
||||
|
|
|
@ -13,4 +13,4 @@ requirements = []
|
|||
source = "github"
|
||||
|
||||
[etags]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1721831095, nanos_since_epoch = 72101000 }, "a746f5b5cd3c2ca5dc19c43bcfc64230c546fafea2ba5f8e340c227b85886078"]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1722524443, nanos_since_epoch = 30564000 }, "ba17f973dcfbcb106f8fef361283ad424830a5cf5986a386e4e61dd98a99e5c8"]
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"plutusVersion": "v2",
|
||||
"compiler": {
|
||||
"name": "Aiken",
|
||||
"version": "v1.0.29-alpha+dfce9c1"
|
||||
"version": "v1.0.31-alpha+896cec4"
|
||||
}
|
||||
},
|
||||
"validators": [
|
||||
|
|
|
@ -13,4 +13,4 @@ requirements = []
|
|||
source = "github"
|
||||
|
||||
[etags]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1721831087, nanos_since_epoch = 901025000 }, "a746f5b5cd3c2ca5dc19c43bcfc64230c546fafea2ba5f8e340c227b85886078"]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1722524447, nanos_since_epoch = 425976000 }, "ba17f973dcfbcb106f8fef361283ad424830a5cf5986a386e4e61dd98a99e5c8"]
|
||||
|
|
|
@ -13,4 +13,4 @@ requirements = []
|
|||
source = "github"
|
||||
|
||||
[etags]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1721831095, nanos_since_epoch = 812343000 }, "a746f5b5cd3c2ca5dc19c43bcfc64230c546fafea2ba5f8e340c227b85886078"]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1722524446, nanos_since_epoch = 746452000 }, "ba17f973dcfbcb106f8fef361283ad424830a5cf5986a386e4e61dd98a99e5c8"]
|
||||
|
|
|
@ -13,4 +13,4 @@ requirements = []
|
|||
source = "github"
|
||||
|
||||
[etags]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1721831088, nanos_since_epoch = 549014000 }, "a746f5b5cd3c2ca5dc19c43bcfc64230c546fafea2ba5f8e340c227b85886078"]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1722524440, nanos_since_epoch = 769930000 }, "ba17f973dcfbcb106f8fef361283ad424830a5cf5986a386e4e61dd98a99e5c8"]
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"plutusVersion": "v2",
|
||||
"compiler": {
|
||||
"name": "Aiken",
|
||||
"version": "v1.0.29-alpha+dfce9c1"
|
||||
"version": "v1.0.31-alpha+896cec4"
|
||||
}
|
||||
},
|
||||
"validators": [
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"plutusVersion": "v2",
|
||||
"compiler": {
|
||||
"name": "Aiken",
|
||||
"version": "v1.0.29-alpha+dfce9c1"
|
||||
"version": "v1.0.31-alpha+896cec4"
|
||||
}
|
||||
},
|
||||
"validators": [
|
||||
|
|
|
@ -3,13 +3,14 @@
|
|||
|
||||
[[requirements]]
|
||||
name = "aiken-lang/stdlib"
|
||||
version = "1.7.0"
|
||||
version = "main"
|
||||
source = "github"
|
||||
|
||||
[[packages]]
|
||||
name = "aiken-lang/stdlib"
|
||||
version = "1.7.0"
|
||||
version = "main"
|
||||
requirements = []
|
||||
source = "github"
|
||||
|
||||
[etags]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1722524446, nanos_since_epoch = 746430000 }, "ba17f973dcfbcb106f8fef361283ad424830a5cf5986a386e4e61dd98a99e5c8"]
|
||||
|
|
|
@ -10,5 +10,5 @@ platform = "github"
|
|||
|
||||
[[dependencies]]
|
||||
name = "aiken-lang/stdlib"
|
||||
version = "1.7.0"
|
||||
version = "main"
|
||||
source = "github"
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"plutusVersion": "v2",
|
||||
"compiler": {
|
||||
"name": "Aiken",
|
||||
"version": "v1.0.29-alpha+dfce9c1"
|
||||
"version": "v1.0.31-alpha+896cec4"
|
||||
},
|
||||
"license": "Apache-2.0"
|
||||
},
|
||||
|
|
|
@ -3,13 +3,14 @@
|
|||
|
||||
[[requirements]]
|
||||
name = "aiken-lang/stdlib"
|
||||
version = "1.7.0"
|
||||
version = "main"
|
||||
source = "github"
|
||||
|
||||
[[packages]]
|
||||
name = "aiken-lang/stdlib"
|
||||
version = "1.7.0"
|
||||
version = "main"
|
||||
requirements = []
|
||||
source = "github"
|
||||
|
||||
[etags]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1722524442, nanos_since_epoch = 481759000 }, "ba17f973dcfbcb106f8fef361283ad424830a5cf5986a386e4e61dd98a99e5c8"]
|
||||
|
|
|
@ -10,5 +10,5 @@ platform = "github"
|
|||
|
||||
[[dependencies]]
|
||||
name = "aiken-lang/stdlib"
|
||||
version = "1.7.0"
|
||||
version = "main"
|
||||
source = "github"
|
||||
|
|
|
@ -24,5 +24,5 @@ requirements = []
|
|||
source = "github"
|
||||
|
||||
[etags]
|
||||
"aiken-lang/fuzz@main" = [{ secs_since_epoch = 1721831088, nanos_since_epoch = 511891000 }, "a8294651f1577c671d580c99c9bc5445ef1fd44e4aa3dde550434a4cbc8d50b6"]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1721831088, nanos_since_epoch = 438426000 }, "a746f5b5cd3c2ca5dc19c43bcfc64230c546fafea2ba5f8e340c227b85886078"]
|
||||
"aiken-lang/fuzz@main" = [{ secs_since_epoch = 1722524441, nanos_since_epoch = 812571000 }, "24d601fa19a2002318495bbb8562b9677563ca1b5c03126d6b093a65df076bef"]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1722524441, nanos_since_epoch = 386266000 }, "ba17f973dcfbcb106f8fef361283ad424830a5cf5986a386e4e61dd98a99e5c8"]
|
||||
|
|
|
@ -13,4 +13,4 @@ requirements = []
|
|||
source = "github"
|
||||
|
||||
[etags]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1721831077, nanos_since_epoch = 252706000 }, "a746f5b5cd3c2ca5dc19c43bcfc64230c546fafea2ba5f8e340c227b85886078"]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1722524444, nanos_since_epoch = 266447000 }, "ba17f973dcfbcb106f8fef361283ad424830a5cf5986a386e4e61dd98a99e5c8"]
|
||||
|
|
|
@ -24,5 +24,5 @@ requirements = []
|
|||
source = "github"
|
||||
|
||||
[etags]
|
||||
"aiken-lang/fuzz@main" = [{ secs_since_epoch = 1721831077, nanos_since_epoch = 488991000 }, "a8294651f1577c671d580c99c9bc5445ef1fd44e4aa3dde550434a4cbc8d50b6"]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1721831077, nanos_since_epoch = 254488000 }, "a746f5b5cd3c2ca5dc19c43bcfc64230c546fafea2ba5f8e340c227b85886078"]
|
||||
"aiken-lang/fuzz@main" = [{ secs_since_epoch = 1722524441, nanos_since_epoch = 821696000 }, "24d601fa19a2002318495bbb8562b9677563ca1b5c03126d6b093a65df076bef"]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1722524441, nanos_since_epoch = 608068000 }, "ba17f973dcfbcb106f8fef361283ad424830a5cf5986a386e4e61dd98a99e5c8"]
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"plutusVersion": "v2",
|
||||
"compiler": {
|
||||
"name": "Aiken",
|
||||
"version": "v1.0.29-alpha+dfce9c1"
|
||||
"version": "v1.0.31-alpha+896cec4"
|
||||
},
|
||||
"license": "Apache-2.0"
|
||||
},
|
||||
|
|
|
@ -13,4 +13,4 @@ requirements = []
|
|||
source = "github"
|
||||
|
||||
[etags]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1719353165, nanos_since_epoch = 165401000 }, "a746f5b5cd3c2ca5dc19c43bcfc64230c546fafea2ba5f8e340c227b85886078"]
|
||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1722524450, nanos_since_epoch = 413566000 }, "ba17f973dcfbcb106f8fef361283ad424830a5cf5986a386e4e61dd98a99e5c8"]
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"plutusVersion": "v2",
|
||||
"compiler": {
|
||||
"name": "Aiken",
|
||||
"version": "v1.0.29-alpha+e856fc6"
|
||||
"version": "v1.0.31-alpha+896cec4"
|
||||
}
|
||||
},
|
||||
"validators": [
|
||||
|
@ -23,8 +23,8 @@
|
|||
"$ref": "#/definitions/Void"
|
||||
}
|
||||
},
|
||||
"compiledCode": "5904000100003232323232323232323232232322322533300932533300a33300a3375e602060226022602260226022602260226022602260226022601a6ea8c004c034dd5001260126d8799f58200000000000000000000000000000000000000000000000000000000000000000ff004a09444c94ccc02cc94ccc030cdc3a4004601c6ea80044c94ccc034cdd7980218081baa0014c0126d8799f58200000000000000000000000000000000000000000000000000000000000000000ff0013009375a600660206ea8004528180918079baa001153300d4911c73637269707420707572706f73652069736e277420275370656e642700163001300e375400626464a66601a6464a6660260022a6602092011c756e6578706563746564206e756d626572206f66206f757470757473001615333013301600113253330103375e600c60266ea8004dd318022410151ad720e2a66602066ebcc01cc04cdd5180398099baa0014c0122d8799f581c11111111111111111111111111111111111111111111111111111111ff00153330105333010300c30123754600c60266ea8c01cc04cdd50008a5014a22a66602066ebcc00cc04cdd5000a60103d879800013375e600a60266ea800530103d87a800014a029405280a50301500115330104911c756e6578706563746564206e756d626572206f66206f75747075747300163758600260226ea8c014c044dd50031180a180a980a800899baf300230103754600860206ea8014dd31800a40a8294094ccc034c02400452f5bded8c0264646600200297adef6c6022533301400113301533760981014000374c00697adef6c60132323232533301433720910100002133019337609801014000374c00e00a2a66602866e3d22100002133019337609801014000374c00e00626603266ec0dd48011ba6001330060060033756602c0066eb8c050008c060008c058004c8cc0040052f5bded8c044a66602600226602866ec13001014000375000697adef6c60132323232533301333720910100002133018337609801014000375000e00a2a66602666e3d22100002133018337609801014000375000e00626603066ec0dd48011ba800133006006003375a602a0066eb8c04c008c05c008c0540048c048c04cc04cc04c0045281180898090008a5023010001149854cc0292411856616c696461746f722072657475726e65642066616c73650013656533333300f001153330073003300937540022a66601660146ea8004526005005005005005005533333300d002153330053001300737540042a66601260106ea8008526004004004004004004370e90000a99801a4810f5f72656465656d65723a20566f6964001615330024910c5f646174756d3a20566f696400165734ae7155ceaab9e5573eae815d0aba257481",
|
||||
"hash": "226bec4fd3005ec13cdd5d68226362cd6a9a107726eee2e6ee8fd299"
|
||||
"compiledCode": "590340010000323232323232323223232232253330073253330083330083375e601a601c601c601c601c601c601c601c601c601c601c601c60146ea8c004c028dd5001260126d8799f58200000000000000000000000000000000000000000000000000000000000000000ff004a09444c94ccc024c94ccc028cdc3a400460166ea80044c94ccc02ccdd7980218069baa0014c0126d8799f58200000000000000000000000000000000000000000000000000000000000000000ff0013009375a6006601a6ea8004528180798061baa001163001300b375400626464a6660166464a6660200022c2a6660206026002264a66601c66ebcc018c040dd50009ba6300448202a35ae41c54ccc038cdd7980398081baa30073010375400298122d8799f581c11111111111111111111111111111111111111111111111111111111ff001533300e533300e300c300f3754600c60206ea8c01cc040dd50008a5014a22a66601c66ebcc00cc040dd5000a60103d879800013375e600a60206ea800530103d87a800014a029405280a5030120011637586002601c6ea8c014c038dd50031180898091809000899baf3002300d37546008601a6ea8014dd31800a40a8294094ccc02cc02400452f5bded8c0264646600200297adef6c6022533301100113301233760981014000374c00697adef6c60132323232533301233720910100002133016337609801014000374c00e00a2a66602466e3d22100002133016337609801014000374c00e00626602c66ec0dd48011ba600133006006003375660260066eb8c044008c054008c04c004c8cc0040052f5bded8c044a66602000226602266ec13001014000375000697adef6c60132323232533301133720910100002133015337609801014000375000e00a2a66602266e3d22100002133015337609801014000375000e00626602a66ec0dd48011ba800133006006003375a60240066eb8c040008c050008c0480048c03cc040c040c0400045281180718078008a502300d00114984d9594cccccc03000454ccc014c00cc018dd50008a99980418039baa00114985858585858594cccccc02800854ccc00cc004c010dd50010a99980318029baa0021498585858585858dc3a4000ae6955ceaab9e5573eae815d0aba25749",
|
||||
"hash": "b4722fea910f2527073750f2d145f259ef3d8fec59b726abfd36a0b1"
|
||||
},
|
||||
{
|
||||
"title": "deploy.spend",
|
||||
|
@ -40,8 +40,8 @@
|
|||
"$ref": "#/definitions/Data"
|
||||
}
|
||||
},
|
||||
"compiledCode": "59039d01000032323232323232323232222533300553330053375e00698103d8798000132533300633232232533300a3370e900018061baa0011323232533300d3375e980106d8799f182aff0000213370e600c00a90020a50533300c3370e900018071baa001132533301100100c132533301230150021498034c94cccccc0580040340340344dd6800806980980098079baa00100b5333333013001100100a00a00a00a3010300d37540022a660169215865787065637420536f6d6528646174756d29203d0a20202020646963742e67657428646174756d732c20626c616b6532625f323536286275696c74696e2e73657269616c6973655f64617461286d795f646174756d292929001632323300100100322533301000114c0103d87a800013232323253330103372200e0042a66602066e3c01c0084cdd2a40006602a00297ae014c0103d87a80001330060060033012003375c6020004602800460240026e50dd9a6106d8799f182aff00300100122533300c0011480004cdc02400466004004601e0026eacc030c034c034c034c034c034c034c034c034c034c034c024dd5180098049baa00213232533300c00115330094901316578706563746564207472616e73616374696f6e20746f206861766520286174206c65617374292032206f7574707574730016132533300d001153300a4901316578706563746564207472616e73616374696f6e20746f206861766520286174206c65617374292032206f7574707574730016132533300a32533300b3375e600a601c6ea800530126d87a9f5820fcaa61fb85676101d9e3398a484674e71c45c3fd41b492682f3b0054f4cf3273ff0013375e6022602460246024601c6ea800530122d8799f581ce37db487fbd58c45d059bcbf5cd6b1604d3bec16cf888f1395a4ebc4ff0014a060200062a66601466ebcc040c044c034dd5180298069baa0014c012ad8799fd8799fd8799f581c66666666666666666666666666666666666666666666666666666666ffffff001533300a3370e900218061baa3004300d3754002294454cc02d24115657870656374656420696e6c696e6520646174756d001614a02940c03c004c03c004dd6180098051baa3002300a37540064601a601c601c00229408c0300045280a4c2a6600c92011856616c696461746f722072657475726e65642066616c73650013656153300249011d65787065637420646174756d3a204d79446174756d203d20646174756d00165734ae7155ceaab9e5573eae815d0aba257481",
|
||||
"hash": "9b1c63d96ca0f51733f625fa71daccce4e921ab5d2ac71e1683471d7"
|
||||
"compiledCode": "5902620100003232323232323232222533300453330043375e00698103d879800013253330053323223253330093370e900018051baa0011323232533300c3375e980106d8799f182aff0000213370e600c00a90020a50533300b3370e900018061baa001132533300f0011613253330103013002149858c94cccccc0500045858584dd68008b180880098069baa001165333333011001100116161616300e300b37540022c64646600200200644a66601c002298103d87a8000132323232533300f3372200e0042a66601e66e3c01c0084cdd2a40006602600297ae014c0103d87a80001330060060033010003375c601c004602400460200026e50dd9a6106d8799f182aff00300100122533300a0011480004cdc02400466004004601a0026eacc028c02cc02cc02cc02cc02cc02cc02cc02cc02cc02cc01cdd5180098039baa00213232533300a00116132533300b00116132533300932533300a3375e600a60186ea800530126d87a9f5820fcaa61fb85676101d9e3398a484674e71c45c3fd41b492682f3b0054f4cf3273ff0013375e601e60206020602060186ea800530122d8799f581ce37db487fbd58c45d059bcbf5cd6b1604d3bec16cf888f1395a4ebc4ff0014a0601c0062a66601266ebcc038c03cc02cdd5180298059baa0014c012ad8799fd8799fd8799f581c66666666666666666666666666666666666666666666666666666666ffffff00153330093370e900218051baa3004300b37540022944585280a50300d001300d0013758600260106ea8c008c020dd500191805980618060008a502300a00114a029309b2b2b9a5573aaae7955cfaba05742ae895d201",
|
||||
"hash": "afe28fb3a5ca0c66aa19eb0ea419c60e20ea6e3c82875f74db76d32e"
|
||||
},
|
||||
{
|
||||
"title": "mint.mint",
|
||||
|
@ -51,8 +51,8 @@
|
|||
"$ref": "#/definitions/Data"
|
||||
}
|
||||
},
|
||||
"compiledCode": "590496010000323232323232323232225333004323232323253323300a3232533301000100b13253330113014002132533300e300530103754002266e3c008dd7180a18089baa001153300f49124657870656374204d696e7428706f6c6963795f696429203d206374782e707572706f736500163008301037540140186eb8c048004cc004004cc010c00cdd5980298071baa3007300e375401091010022533301000114bd70099808980718090009980100118098008a999191980619912999807180298081baa002132533300f3005301137540022a6602092010f746f6b656e206e6f7420666f756e64001613370e6eb4c054c048dd5000a41e428646600200264a666020600c60246ea800452f5bded8c026eacc058c04cdd500099191980080098049bab300b3014375400844a66602c002298103d87a800013232323253330163372200e0042a66602c66e3c01c0084c02ccc06cdd3000a5eb80530103d87a8000133006006003375660300066eb8c058008c068008c060004dd7180a98091baa00322533301400114c103d87a800013232323253330143372291103666f6f00002153330143371e910103666f6f000021300933019375000297ae014c0103d87a8000133006006003375a602c0066eb8c050008c060008c05800454cc03d24120657870656374204d696e7428706f6c6963795f696429203d20707572706f736500163007300f37540126010601e6ea80244c8c8c8c94ccc040c01cc048dd50008a99980819baf00e30133233760602e002602e60300026eb0c058c04cdd50008980318011bab300430133754601860266ea80345280a99808a496b65787065637420536f6d652850616972285f2c2072656465656d65722929203d0a202020206c6973742e66696e64286374782e7472616e73616374696f6e2e72656465656d6572732c20666e286b7629207b206b762e317374203d3d206374782e707572706f7365207d29001632330010013756600860266ea8c030c04cdd500691299980a8008a6103d87a80001323253330133375e602a004601c602c6ea80404c020cc060dd39980c180a8011980c180b00125eb812f5c02660080080026032004602e002600200244a66602600229000099b8048008cc008008c0580048c04cc050c050c050c050c050c050c050c050c050004dd2a40006e1d200214a06e1d200014a046600400291010022323300100100322533300f00114bd6f7b630099191919299980799b910070021533300f3371e00e0042006200a26602866ec0dd48011ba600133006006003375660220066eb8c03c008c04c008c0440048c034c038c038c038c0380048c030c0340048c02c00452615330054911856616c696461746f722072657475726e65642066616c736500136561533002490189657870656374205b6d795f706f6c6963795f69645d203d0a202020206374782e7472616e73616374696f6e2e6d696e740a2020202020207c3e2076616c75652e66726f6d5f6d696e7465645f76616c75650a2020202020207c3e2076616c75652e776974686f75745f6c6f76656c6163650a2020202020207c3e2076616c75652e706f6c696369657300165734ae7155ceaab9e5573eae815d0aba21",
|
||||
"hash": "8372367de2b0391b1bec0489dc72cb65de1a791f4e9712b9149d6392"
|
||||
"compiledCode": "5903070100003232323232323222533300332323232325332330093232533300e00116132533300f3012002132533300d3005300e3754002266e3c008dd7180918079baa001163008300e37540142c6eb8c040004cc004004cc010c00cdd5980298061baa3007300c375401091010022533300e00114bd70099807980618080009980100118088008a999191980599912999806980298071baa002132533300e3005300f37540022c266e1cdd6980998081baa001483c850c8cc004004c94ccc03cc018c040dd50008a5eb7bdb1804dd5980a18089baa00132323300100130093756601660246ea8010894ccc0500045300103d87a800013232323253330153372200e0042a66602a66e3c01c0084c02ccc064dd3000a5eb80530103d87a80001330060060033756602c0066eb8c050008c060008c058004dd7180998081baa00322533301200114c103d87a800013232323253330133372291103666f6f00002153330133371e910103666f6f000021300933017375000297ae014c0103d87a8000133006006003375a60280066eb8c048008c058008c05000458c01cc034dd5004980418069baa009132323232533300f3007301037540022a66601e66ebc038c044c8cdd8180a800980a980b0009bac3014301137540022600c60046eacc010c044dd5180618089baa00d14a02c64660020026eacc010c044dd5180618089baa00d22533301300114c103d87a80001323253330123375e6026004601c60286ea80404c020cc058dd39980b18098011980b180a00125eb812f5c0266008008002602e004602a002600200244a66602200229000099b8048008cc008008c0500048c044c048c048c048c048c048c048c048c048c048004dd2a40006e1d200214a06e1d200014a046600400291010022323300100100322533300d00114bd6f7b630099191919299980719b910070021533300e3371e00e0042006200a26602466ec0dd48011ba6001330060060033756601e0066eb8c034008c044008c03c0048c02cc030c030c030c0300048c028c02c0048c024004526136565734aae7555cf2ab9f5740ae855d101",
|
||||
"hash": "cae7d307b37aaa4d2500641c8c6e823ea313aa43fb6dbc9ed72b7228"
|
||||
},
|
||||
{
|
||||
"title": "withdrawals.spend",
|
||||
|
@ -68,8 +68,8 @@
|
|||
"$ref": "#/definitions/Void"
|
||||
}
|
||||
},
|
||||
"compiledCode": "5902e2010000323232323232323232323223223225333008323232533300b32533300c3370e900118071baa001153300d4911c616c6963652773207769746864726177616c206e6f7420666f756e64001613370e6eb4c03cc8cdd818098009809980a0009bac3012300f3754002902a198009bab3002300e37546006601c6ea80108cdd79807000a6126d8799fd8799f581c22222222222222222222222222222222222222222222222222222222ffff001533300b32533300c3370e900118071baa001153300d49011a626f622773207769746864726177616c206e6f7420666f756e64001613370e6eb4c03cc8cdd818098009809980a0009bac3012300f3754002900e198009bab3002300e37546006601c6ea80108cdd79807000a6126d8799fd87a9f581cafddc16c18e7d8de379fb9aad39b3d1b5afd27603e5ebac818432a72ffff0013375e6e9cc8cc004004dd5980198079baa3004300f375400a44a666022002297ae0133012300f3013001330020023014001374e6602098126d8799fd8799f581c22222222222222222222222222222222222222222222222222222222ffff00330104c126d8799fd87a9f581cafddc16c18e7d8de379fb9aad39b3d1b5afd27603e5ebac818432a72ffff004bd700a5014a044646600200200644a666024002298103d87a8000132325333010300500213374a90001980a9ba73301530120023301530130024bd7025eb804cc010010004c058008c0500048c040c044c044c044c044c044c0440048c03c00452615330094911856616c696461746f722072657475726e65642066616c73650013656533333300e001153330063370e900018041baa0011533300a3009375400229300200200200200200229999998060008a99980219b8748000c018dd50008a99980418039baa001149800c00c00c00c00c00c54cc00d2410f5f72656465656d65723a20566f6964001615330024910c5f646174756d3a20566f696400165734ae7155ceaab9e5573eae815d0aba257481",
|
||||
"hash": "2278726afe2d74b58a5314acc2b66c12feda88d18d821abd456b2561"
|
||||
"compiledCode": "590249010000323232323232323223223225333006323232533300932533300a3370e900118059baa0011613370e6eb4c030c8cdd81808000980818088009bac300f300c3754002902a198009bab3002300b3754600660166ea80108cdd79805800a6126d8799fd8799f581c22222222222222222222222222222222222222222222222222222222ffff001533300932533300a3370e900118059baa0011613370e6eb4c030c8cdd81808000980818088009bac300f300c3754002900e198009bab3002300b3754600660166ea80108cdd79805800a60126d8799fd87a9f581cafddc16c18e7d8de379fb9aad39b3d1b5afd27603e5ebac818432a72ffff0013375e6e9cc8cc004004dd5980198061baa3004300c375400a44a66601c002297ae013300f300c3010001330020023011001374e6601a98126d8799fd8799f581c22222222222222222222222222222222222222222222222222222222ffff003300d4c126d8799fd87a9f581cafddc16c18e7d8de379fb9aad39b3d1b5afd27603e5ebac818432a72ffff004bd700a5014a044646600200200644a66601e002298103d87a800013232533300e300500213374a9000198091ba733012300f0023301230100024bd7025eb804cc010010004c04c008c0440048c034c038c038c038c038c038c0380048c03000452613656533333300b001153330043370e900018029baa00115333007300637540022930b0b0b0b0b0b29999998048008a99980119b8748000c00cdd50008a99980298021baa00114985858585858595cd2ab9d5573caae7d5d02ba15744ae901",
|
||||
"hash": "45d4f36c2dcf9831e37995edb428bed6928a55b39b401c1dd5ab7886"
|
||||
}
|
||||
],
|
||||
"definitions": {
|
||||
|
|
Loading…
Reference in New Issue