chore: clippy fix

This commit is contained in:
rvcas
2023-09-13 18:17:59 -04:00
parent bc0824f4eb
commit d808197507
23 changed files with 336 additions and 352 deletions

View File

@@ -1,5 +1,5 @@
use indexmap::IndexSet;
use std::sync::Arc;
use std::rc::Rc;
use uplc::builtins::DefaultFunction;
use crate::{
@@ -24,11 +24,11 @@ pub enum Air {
},
List {
count: usize,
tipo: Arc<Type>,
tipo: Rc<Type>,
tail: bool,
},
Tuple {
tipo: Arc<Type>,
tipo: Rc<Type>,
count: usize,
},
Void,
@@ -40,7 +40,7 @@ pub enum Air {
// Functions
Call {
count: usize,
tipo: Arc<Type>,
tipo: Rc<Type>,
},
DefineFunc {
func_name: String,
@@ -56,13 +56,13 @@ pub enum Air {
Builtin {
count: usize,
func: DefaultFunction,
tipo: Arc<Type>,
tipo: Rc<Type>,
},
// Operators
BinOp {
name: BinOp,
tipo: Arc<Type>,
argument_tipo: Arc<Type>,
tipo: Rc<Type>,
argument_tipo: Rc<Type>,
},
UnOp {
op: UnOp,
@@ -72,10 +72,10 @@ pub enum Air {
name: String,
},
CastFromData {
tipo: Arc<Type>,
tipo: Rc<Type>,
},
CastToData {
tipo: Arc<Type>,
tipo: Rc<Type>,
},
AssertConstr {
constr_index: usize,
@@ -85,24 +85,24 @@ pub enum Air {
},
// When
When {
tipo: Arc<Type>,
tipo: Rc<Type>,
subject_name: String,
subject_tipo: Arc<Type>,
subject_tipo: Rc<Type>,
},
Clause {
subject_tipo: Arc<Type>,
subject_tipo: Rc<Type>,
subject_name: String,
complex_clause: bool,
},
ListClause {
subject_tipo: Arc<Type>,
subject_tipo: Rc<Type>,
tail_name: String,
next_tail_name: Option<(String, String)>,
complex_clause: bool,
},
WrapClause,
TupleClause {
subject_tipo: Arc<Type>,
subject_tipo: Rc<Type>,
indices: IndexSet<(usize, String)>,
predefined_indices: IndexSet<(usize, String)>,
subject_name: String,
@@ -110,72 +110,72 @@ pub enum Air {
},
ClauseGuard {
subject_name: String,
subject_tipo: Arc<Type>,
subject_tipo: Rc<Type>,
},
ListClauseGuard {
subject_tipo: Arc<Type>,
subject_tipo: Rc<Type>,
tail_name: String,
next_tail_name: Option<String>,
inverse: bool,
},
TupleGuard {
subject_tipo: Arc<Type>,
subject_tipo: Rc<Type>,
indices: IndexSet<(usize, String)>,
subject_name: String,
},
Finally,
// If
If {
tipo: Arc<Type>,
tipo: Rc<Type>,
},
// Record Creation
Constr {
tag: usize,
tipo: Arc<Type>,
tipo: Rc<Type>,
count: usize,
},
RecordUpdate {
highest_index: usize,
indices: Vec<(usize, Arc<Type>)>,
tipo: Arc<Type>,
indices: Vec<(usize, Rc<Type>)>,
tipo: Rc<Type>,
},
// Field Access
RecordAccess {
record_index: u64,
tipo: Arc<Type>,
tipo: Rc<Type>,
},
FieldsExpose {
indices: Vec<(usize, String, Arc<Type>)>,
indices: Vec<(usize, String, Rc<Type>)>,
check_last_item: bool,
},
// ListAccess
ListAccessor {
tipo: Arc<Type>,
tipo: Rc<Type>,
names: Vec<String>,
tail: bool,
check_last_item: bool,
},
ListExpose {
tipo: Arc<Type>,
tipo: Rc<Type>,
tail_head_names: Vec<(String, String)>,
tail: Option<(String, String)>,
},
// Tuple Access
TupleAccessor {
names: Vec<String>,
tipo: Arc<Type>,
tipo: Rc<Type>,
check_last_item: bool,
},
TupleIndex {
tipo: Arc<Type>,
tipo: Rc<Type>,
tuple_index: usize,
},
// Misc.
ErrorTerm {
tipo: Arc<Type>,
tipo: Rc<Type>,
},
Trace {
tipo: Arc<Type>,
tipo: Rc<Type>,
},
NoOp,
FieldsEmpty,

View File

@@ -1,4 +1,4 @@
use std::{collections::HashMap, rc::Rc, sync::Arc};
use std::{collections::HashMap, rc::Rc};
use indexmap::{IndexMap, IndexSet};
use itertools::Itertools;
@@ -15,7 +15,8 @@ use uplc::{
use crate::{
ast::{
AssignmentKind, DataType, Pattern, Span, TypedArg, TypedClause, TypedDataType, TypedPattern,
AssignmentKind, DataType, Pattern, Span, TypedArg, TypedClause, TypedClauseGuard,
TypedDataType, TypedPattern,
},
builtins::{bool, void},
expr::TypedExpr,
@@ -80,7 +81,7 @@ pub struct FunctionAccessKey {
#[derive(Clone, Debug)]
pub struct AssignmentProperties {
pub value_type: Arc<Type>,
pub value_type: Rc<Type>,
pub kind: AssignmentKind,
pub remove_unused: bool,
pub full_check: bool,
@@ -110,7 +111,7 @@ pub enum SpecificClause {
}
impl ClauseProperties {
pub fn init(t: &Arc<Type>, constr_var: String, subject_name: String) -> Self {
pub fn init(t: &Rc<Type>, constr_var: String, subject_name: String) -> Self {
if t.is_list() {
ClauseProperties {
clause_var_name: constr_var,
@@ -148,7 +149,7 @@ impl ClauseProperties {
}
pub fn init_inner(
t: &Arc<Type>,
t: &Rc<Type>,
constr_var: String,
subject_name: String,
final_clause: bool,
@@ -190,7 +191,7 @@ impl ClauseProperties {
}
}
pub fn get_generic_id_and_type(tipo: &Type, param: &Type) -> Vec<(u64, Arc<Type>)> {
pub fn get_generic_id_and_type(tipo: &Type, param: &Type) -> Vec<(u64, Rc<Type>)> {
let mut generics_ids = vec![];
if let Some(id) = tipo.get_generic() {
@@ -211,7 +212,7 @@ pub fn get_generic_id_and_type(tipo: &Type, param: &Type) -> Vec<(u64, Arc<Type>
pub fn lookup_data_type_by_tipo(
data_types: &IndexMap<DataTypeKey, &TypedDataType>,
tipo: &Type,
) -> Option<DataType<Arc<Type>>> {
) -> Option<DataType<Rc<Type>>> {
match tipo {
Type::Fn { ret, .. } => match ret.as_ref() {
Type::App { module, name, .. } => {
@@ -261,20 +262,19 @@ pub fn get_arg_type_name(tipo: &Type) -> String {
}
pub fn convert_opaque_type(
t: &Arc<Type>,
t: &Rc<Type>,
data_types: &IndexMap<DataTypeKey, &TypedDataType>,
) -> Arc<Type> {
) -> Rc<Type> {
if check_replaceable_opaque_type(t, data_types) && matches!(t.as_ref(), Type::App { .. }) {
let data_type = lookup_data_type_by_tipo(data_types, t).unwrap();
let new_type_fields = data_type.typed_parameters;
let mono_types: IndexMap<u64, Arc<Type>>;
let mut mono_type_vec = vec![];
for (tipo, param) in new_type_fields.iter().zip(t.arg_types().unwrap()) {
mono_type_vec.append(&mut get_generic_id_and_type(tipo, &param));
}
mono_types = mono_type_vec.into_iter().collect();
let mono_types = mono_type_vec.into_iter().collect();
let generic_type = &data_type.constructors[0].arguments[0].tipo;
@@ -337,7 +337,7 @@ pub fn convert_opaque_type(
}
pub fn check_replaceable_opaque_type(
t: &Arc<Type>,
t: &Rc<Type>,
data_types: &IndexMap<DataTypeKey, &TypedDataType>,
) -> bool {
let data_type = lookup_data_type_by_tipo(data_types, t);
@@ -352,9 +352,9 @@ pub fn check_replaceable_opaque_type(
}
pub fn find_and_replace_generics(
tipo: &Arc<Type>,
mono_types: &IndexMap<u64, Arc<Type>>,
) -> Arc<Type> {
tipo: &Rc<Type>,
mono_types: &IndexMap<u64, Rc<Type>>,
) -> Rc<Type> {
if let Some(id) = tipo.get_generic() {
// If a generic does not have a type we know of
// like a None in option then just use same type
@@ -427,7 +427,7 @@ pub fn constants_ir(literal: &Constant) -> AirTree {
}
}
pub fn handle_clause_guard(clause_guard: &ClauseGuard<Arc<Type>>) -> AirTree {
pub fn handle_clause_guard(clause_guard: &TypedClauseGuard) -> AirTree {
match clause_guard {
ClauseGuard::Not { value, .. } => {
let val = handle_clause_guard(value);
@@ -487,7 +487,7 @@ pub fn handle_clause_guard(clause_guard: &ClauseGuard<Arc<Type>>) -> AirTree {
}
}
pub fn get_variant_name(t: &Arc<Type>) -> String {
pub fn get_variant_name(t: &Rc<Type>) -> String {
if t.is_string() {
"_string".to_string()
} else if t.is_int() {
@@ -531,7 +531,7 @@ pub fn get_variant_name(t: &Arc<Type>) -> String {
}
}
pub fn monomorphize(air_tree: &mut AirTree, mono_types: &IndexMap<u64, Arc<Type>>) {
pub fn monomorphize(air_tree: &mut AirTree, mono_types: &IndexMap<u64, Rc<Type>>) {
let mut held_types = air_tree.mut_held_types();
while let Some(tipo) = held_types.pop() {
@@ -1029,7 +1029,7 @@ pub fn find_list_clause_or_default_first(clauses: &[TypedClause]) -> &TypedClaus
.unwrap_or(&clauses[0])
}
pub fn convert_data_to_type(term: Term<Name>, field_type: &Arc<Type>) -> Term<Name> {
pub fn convert_data_to_type(term: Term<Name>, field_type: &Rc<Type>) -> Term<Name> {
if field_type.is_int() {
Term::un_i_data().apply(term)
} else if field_type.is_bytearray() {
@@ -1142,7 +1142,7 @@ pub fn convert_constants_to_data(constants: Vec<Rc<UplcConstant>>) -> Vec<UplcCo
new_constants
}
pub fn convert_type_to_data(term: Term<Name>, field_type: &Arc<Type>) -> Term<Name> {
pub fn convert_type_to_data(term: Term<Name>, field_type: &Rc<Type>) -> Term<Name> {
if field_type.is_bytearray() {
Term::b_data().apply(term)
} else if field_type.is_int() {
@@ -1206,7 +1206,7 @@ pub fn list_access_to_uplc(
tail: bool,
current_index: usize,
term: Term<Name>,
tipos: Vec<Arc<Type>>,
tipos: Vec<Rc<Type>>,
check_last_item: bool,
is_list_accessor: bool,
tracing: bool,
@@ -1409,7 +1409,7 @@ pub fn apply_builtin_forces(mut term: Term<Name>, force_count: u32) -> Term<Name
pub fn undata_builtin(
func: &DefaultFunction,
count: usize,
tipo: &Arc<Type>,
tipo: &Rc<Type>,
args: Vec<Term<Name>>,
) -> Term<Name> {
let mut term: Term<Name> = (*func).into();
@@ -1437,7 +1437,7 @@ pub fn undata_builtin(
pub fn to_data_builtin(
func: &DefaultFunction,
count: usize,
tipo: &Arc<Type>,
tipo: &Rc<Type>,
mut args: Vec<Term<Name>>,
) -> Term<Name> {
let mut term: Term<Name> = (*func).into();
@@ -1575,7 +1575,7 @@ pub fn wrap_as_multi_validator(spend: Term<Name>, mint: Term<Name>) -> Term<Name
/// If the pattern is a list the return the number of elements and if it has a tail
/// Otherwise return None
pub fn get_list_elements_len_and_tail(
pattern: &Pattern<PatternConstructor, Arc<Type>>,
pattern: &Pattern<PatternConstructor, Rc<Type>>,
) -> Option<(usize, bool)> {
if let Pattern::List { elements, tail, .. } = &pattern {
Some((elements.len(), tail.is_some()))

View File

@@ -1,6 +1,6 @@
use indexmap::IndexSet;
use itertools::Itertools;
use std::{borrow::BorrowMut, slice::Iter, sync::Arc};
use std::{borrow::BorrowMut, rc::Rc, slice::Iter};
use uplc::{builder::EXPECT_ON_LIST, builtins::DefaultFunction};
use crate::{
@@ -145,43 +145,43 @@ pub enum AirStatement {
// Clause Guards
ClauseGuard {
subject_name: String,
subject_tipo: Arc<Type>,
subject_tipo: Rc<Type>,
pattern: Box<AirTree>,
},
ListClauseGuard {
subject_tipo: Arc<Type>,
subject_tipo: Rc<Type>,
tail_name: String,
next_tail_name: Option<String>,
inverse: bool,
},
TupleGuard {
subject_tipo: Arc<Type>,
subject_tipo: Rc<Type>,
indices: IndexSet<(usize, String)>,
subject_name: String,
},
// Field Access
FieldsExpose {
indices: Vec<(usize, String, Arc<Type>)>,
indices: Vec<(usize, String, Rc<Type>)>,
check_last_item: bool,
record: Box<AirTree>,
},
// List Access
ListAccessor {
tipo: Arc<Type>,
tipo: Rc<Type>,
names: Vec<String>,
tail: bool,
check_last_item: bool,
list: Box<AirTree>,
},
ListExpose {
tipo: Arc<Type>,
tipo: Rc<Type>,
tail_head_names: Vec<(String, String)>,
tail: Option<(String, String)>,
},
// Tuple Access
TupleAccessor {
names: Vec<String>,
tipo: Arc<Type>,
tipo: Rc<Type>,
check_last_item: bool,
tuple: Box<AirTree>,
},
@@ -211,12 +211,12 @@ pub enum AirExpression {
value: bool,
},
List {
tipo: Arc<Type>,
tipo: Rc<Type>,
tail: bool,
items: Vec<AirTree>,
},
Tuple {
tipo: Arc<Type>,
tipo: Rc<Type>,
items: Vec<AirTree>,
},
Void,
@@ -227,7 +227,7 @@ pub enum AirExpression {
},
// Functions
Call {
tipo: Arc<Type>,
tipo: Rc<Type>,
func: Box<AirTree>,
args: Vec<AirTree>,
},
@@ -238,16 +238,16 @@ pub enum AirExpression {
},
Builtin {
func: DefaultFunction,
tipo: Arc<Type>,
tipo: Rc<Type>,
args: Vec<AirTree>,
},
// Operators
BinOp {
name: BinOp,
tipo: Arc<Type>,
tipo: Rc<Type>,
left: Box<AirTree>,
right: Box<AirTree>,
argument_tipo: Arc<Type>,
argument_tipo: Rc<Type>,
},
UnOp {
op: UnOp,
@@ -255,24 +255,24 @@ pub enum AirExpression {
},
CastFromData {
tipo: Arc<Type>,
tipo: Rc<Type>,
value: Box<AirTree>,
},
CastToData {
tipo: Arc<Type>,
tipo: Rc<Type>,
value: Box<AirTree>,
},
// When
When {
tipo: Arc<Type>,
tipo: Rc<Type>,
subject_name: String,
subject: Box<AirTree>,
subject_tipo: Arc<Type>,
subject_tipo: Rc<Type>,
clauses: Box<AirTree>,
},
Clause {
subject_tipo: Arc<Type>,
subject_tipo: Rc<Type>,
subject_name: String,
complex_clause: bool,
pattern: Box<AirTree>,
@@ -280,7 +280,7 @@ pub enum AirExpression {
otherwise: Box<AirTree>,
},
ListClause {
subject_tipo: Arc<Type>,
subject_tipo: Rc<Type>,
tail_name: String,
next_tail_name: Option<(String, String)>,
complex_clause: bool,
@@ -292,7 +292,7 @@ pub enum AirExpression {
otherwise: Box<AirTree>,
},
TupleClause {
subject_tipo: Arc<Type>,
subject_tipo: Rc<Type>,
indices: IndexSet<(usize, String)>,
predefined_indices: IndexSet<(usize, String)>,
subject_name: String,
@@ -307,7 +307,7 @@ pub enum AirExpression {
},
// If
If {
tipo: Arc<Type>,
tipo: Rc<Type>,
pattern: Box<AirTree>,
then: Box<AirTree>,
otherwise: Box<AirTree>,
@@ -315,34 +315,34 @@ pub enum AirExpression {
// Record Creation
Constr {
tag: usize,
tipo: Arc<Type>,
tipo: Rc<Type>,
args: Vec<AirTree>,
},
RecordUpdate {
highest_index: usize,
indices: Vec<(usize, Arc<Type>)>,
tipo: Arc<Type>,
indices: Vec<(usize, Rc<Type>)>,
tipo: Rc<Type>,
record: Box<AirTree>,
args: Vec<AirTree>,
},
// Field Access
RecordAccess {
field_index: u64,
tipo: Arc<Type>,
tipo: Rc<Type>,
record: Box<AirTree>,
},
// Tuple Access
TupleIndex {
tipo: Arc<Type>,
tipo: Rc<Type>,
tuple_index: usize,
tuple: Box<AirTree>,
},
// Misc.
ErrorTerm {
tipo: Arc<Type>,
tipo: Rc<Type>,
},
Trace {
tipo: Arc<Type>,
tipo: Rc<Type>,
msg: Box<AirTree>,
then: Box<AirTree>,
},
@@ -365,7 +365,7 @@ impl AirTree {
pub fn bool(value: bool) -> AirTree {
AirTree::Expression(AirExpression::Bool { value })
}
pub fn list(mut items: Vec<AirTree>, tipo: Arc<Type>, tail: Option<AirTree>) -> AirTree {
pub fn list(mut items: Vec<AirTree>, tipo: Rc<Type>, tail: Option<AirTree>) -> AirTree {
if let Some(tail) = tail {
items.push(tail);
@@ -382,7 +382,7 @@ impl AirTree {
})
}
}
pub fn tuple(items: Vec<AirTree>, tipo: Arc<Type>) -> AirTree {
pub fn tuple(items: Vec<AirTree>, tipo: Rc<Type>) -> AirTree {
AirTree::Expression(AirExpression::Tuple { tipo, items })
}
pub fn void() -> AirTree {
@@ -399,7 +399,7 @@ impl AirTree {
variant_name: variant_name.to_string(),
})
}
pub fn local_var(name: impl ToString, tipo: Arc<Type>) -> AirTree {
pub fn local_var(name: impl ToString, tipo: Rc<Type>) -> AirTree {
AirTree::Expression(AirExpression::Var {
constructor: ValueConstructor::public(
tipo,
@@ -411,7 +411,7 @@ impl AirTree {
variant_name: "".to_string(),
})
}
pub fn call(func: AirTree, tipo: Arc<Type>, args: Vec<AirTree>) -> AirTree {
pub fn call(func: AirTree, tipo: Rc<Type>, args: Vec<AirTree>) -> AirTree {
AirTree::Expression(AirExpression::Call {
tipo,
func: func.into(),
@@ -446,15 +446,15 @@ impl AirTree {
func_body: func_body.into(),
})
}
pub fn builtin(func: DefaultFunction, tipo: Arc<Type>, args: Vec<AirTree>) -> AirTree {
pub fn builtin(func: DefaultFunction, tipo: Rc<Type>, args: Vec<AirTree>) -> AirTree {
AirTree::Expression(AirExpression::Builtin { func, tipo, args })
}
pub fn binop(
op: BinOp,
tipo: Arc<Type>,
tipo: Rc<Type>,
left: AirTree,
right: AirTree,
argument_tipo: Arc<Type>,
argument_tipo: Rc<Type>,
) -> AirTree {
AirTree::Expression(AirExpression::BinOp {
name: op,
@@ -479,13 +479,13 @@ impl AirTree {
hoisted_over: None,
}
}
pub fn cast_from_data(value: AirTree, tipo: Arc<Type>) -> AirTree {
pub fn cast_from_data(value: AirTree, tipo: Rc<Type>) -> AirTree {
AirTree::Expression(AirExpression::CastFromData {
tipo,
value: value.into(),
})
}
pub fn cast_to_data(value: AirTree, tipo: Arc<Type>) -> AirTree {
pub fn cast_to_data(value: AirTree, tipo: Rc<Type>) -> AirTree {
AirTree::Expression(AirExpression::CastToData {
tipo,
value: value.into(),
@@ -511,8 +511,8 @@ impl AirTree {
}
pub fn when(
subject_name: impl ToString,
tipo: Arc<Type>,
subject_tipo: Arc<Type>,
tipo: Rc<Type>,
subject_tipo: Rc<Type>,
subject: AirTree,
clauses: AirTree,
) -> AirTree {
@@ -527,7 +527,7 @@ impl AirTree {
pub fn clause(
subject_name: impl ToString,
pattern: AirTree,
subject_tipo: Arc<Type>,
subject_tipo: Rc<Type>,
then: AirTree,
otherwise: AirTree,
complex_clause: bool,
@@ -543,7 +543,7 @@ impl AirTree {
}
pub fn list_clause(
tail_name: impl ToString,
subject_tipo: Arc<Type>,
subject_tipo: Rc<Type>,
then: AirTree,
otherwise: AirTree,
next_tail_name: Option<(String, String)>,
@@ -560,7 +560,7 @@ impl AirTree {
}
pub fn tuple_clause(
subject_name: impl ToString,
subject_tipo: Arc<Type>,
subject_tipo: Rc<Type>,
indices: IndexSet<(usize, String)>,
predefined_indices: IndexSet<(usize, String)>,
then: AirTree,
@@ -586,7 +586,7 @@ impl AirTree {
pub fn clause_guard(
subject_name: impl ToString,
pattern: AirTree,
subject_tipo: Arc<Type>,
subject_tipo: Rc<Type>,
) -> AirTree {
AirTree::Statement {
statement: AirStatement::ClauseGuard {
@@ -599,7 +599,7 @@ impl AirTree {
}
pub fn list_clause_guard(
tail_name: impl ToString,
subject_tipo: Arc<Type>,
subject_tipo: Rc<Type>,
inverse: bool,
next_tail_name: Option<String>,
) -> AirTree {
@@ -615,7 +615,7 @@ impl AirTree {
}
pub fn tuple_clause_guard(
subject_name: impl ToString,
subject_tipo: Arc<Type>,
subject_tipo: Rc<Type>,
indices: IndexSet<(usize, String)>,
) -> AirTree {
AirTree::Statement {
@@ -635,7 +635,7 @@ impl AirTree {
}
pub fn if_branches(
mut branches: Vec<(AirTree, AirTree)>,
tipo: Arc<Type>,
tipo: Rc<Type>,
otherwise: AirTree,
) -> AirTree {
assert!(!branches.is_empty());
@@ -659,14 +659,14 @@ impl AirTree {
final_if
}
pub fn create_constr(tag: usize, tipo: Arc<Type>, args: Vec<AirTree>) -> AirTree {
pub fn create_constr(tag: usize, tipo: Rc<Type>, args: Vec<AirTree>) -> AirTree {
AirTree::Expression(AirExpression::Constr { tag, tipo, args })
}
pub fn record_update(
indices: Vec<(usize, Arc<Type>)>,
indices: Vec<(usize, Rc<Type>)>,
highest_index: usize,
tipo: Arc<Type>,
tipo: Rc<Type>,
record: AirTree,
args: Vec<AirTree>,
) -> AirTree {
@@ -678,7 +678,7 @@ impl AirTree {
args,
})
}
pub fn record_access(field_index: u64, tipo: Arc<Type>, record: AirTree) -> AirTree {
pub fn record_access(field_index: u64, tipo: Rc<Type>, record: AirTree) -> AirTree {
AirTree::Expression(AirExpression::RecordAccess {
field_index,
tipo,
@@ -687,7 +687,7 @@ impl AirTree {
}
pub fn fields_expose(
indices: Vec<(usize, String, Arc<Type>)>,
indices: Vec<(usize, String, Rc<Type>)>,
check_last_item: bool,
record: AirTree,
) -> AirTree {
@@ -702,7 +702,7 @@ impl AirTree {
}
pub fn list_access(
names: Vec<String>,
tipo: Arc<Type>,
tipo: Rc<Type>,
tail: bool,
check_last_item: bool,
list: AirTree,
@@ -721,7 +721,7 @@ impl AirTree {
pub fn list_expose(
tail_head_names: Vec<(String, String)>,
tail: Option<(String, String)>,
tipo: Arc<Type>,
tipo: Rc<Type>,
) -> AirTree {
AirTree::Statement {
statement: AirStatement::ListExpose {
@@ -734,7 +734,7 @@ impl AirTree {
}
pub fn tuple_access(
names: Vec<String>,
tipo: Arc<Type>,
tipo: Rc<Type>,
check_last_item: bool,
tuple: AirTree,
) -> AirTree {
@@ -748,17 +748,17 @@ impl AirTree {
hoisted_over: None,
}
}
pub fn tuple_index(tuple_index: usize, tipo: Arc<Type>, tuple: AirTree) -> AirTree {
pub fn tuple_index(tuple_index: usize, tipo: Rc<Type>, tuple: AirTree) -> AirTree {
AirTree::Expression(AirExpression::TupleIndex {
tipo,
tuple_index,
tuple: tuple.into(),
})
}
pub fn error(tipo: Arc<Type>) -> AirTree {
pub fn error(tipo: Rc<Type>) -> AirTree {
AirTree::Expression(AirExpression::ErrorTerm { tipo })
}
pub fn trace(msg: AirTree, tipo: Arc<Type>, then: AirTree) -> AirTree {
pub fn trace(msg: AirTree, tipo: Rc<Type>, then: AirTree) -> AirTree {
AirTree::Expression(AirExpression::Trace {
tipo,
msg: msg.into(),
@@ -1253,7 +1253,7 @@ impl AirTree {
}
}
pub fn return_type(&self) -> Arc<Type> {
pub fn return_type(&self) -> Rc<Type> {
match self {
AirTree::Statement {
hoisted_over: Some(hoisted_over),
@@ -1296,7 +1296,7 @@ impl AirTree {
}
}
pub fn mut_held_types(&mut self) -> Vec<&mut Arc<Type>> {
pub fn mut_held_types(&mut self) -> Vec<&mut Rc<Type>> {
match self {
AirTree::Statement {
statement,