λ Support functions! #5

Open
acw wants to merge 59 commits from awick/functions into develop
5 changed files with 28 additions and 6 deletions
Showing only changes of commit 3d8e0804bc - Show all commits

View File

@@ -0,0 +1 @@
v = -2370389138213399653i64;

View File

@@ -0,0 +1,4 @@
function u (t,h,z,u,a,f,c) 27u8;
function s (p,y,k) 10318938949979263534u64;
o = -98i8;
print o;

View File

@@ -847,22 +847,39 @@ pub fn solve_constraints(
if !changed_something { if !changed_something {
let mut addendums = vec![]; let mut addendums = vec![];
new_constraints.retain(|x| { macro_rules! default_type {
if let Constraint::ConstantNumericType(loc, t) = x { ($addendums: ident, $loc: ident, $t: ident) => {
let resty = TypeOrVar::Primitive(PrimitiveType::U64); let resty = TypeOrVar::Primitive(PrimitiveType::U64);
addendums.push(Constraint::Equivalent( $addendums.push(Constraint::Equivalent(
loc.clone(), $loc.clone(),
t.clone(), $t.clone(),
resty.clone(), resty.clone(),
)); ));
warnings.push(TypeInferenceWarning::DefaultedTo(loc.clone(), resty)); warnings.push(TypeInferenceWarning::DefaultedTo($loc.clone(), resty));
tracing::trace!("Adding number equivalence"); tracing::trace!("Adding number equivalence");
};
}
new_constraints.retain(|x| {
if let Constraint::ConstantNumericType(loc, t) = x {
default_type!(addendums, loc, t);
false false
} else { } else {
true true
} }
}); });
if addendums.is_empty() {
new_constraints.retain(|x| {
if let Constraint::IsSomething(loc, t) = x {
default_type!(addendums, loc, t);
false
} else {
true
}
});
}
if addendums.is_empty() { if addendums.is_empty() {
if errors.is_empty() { if errors.is_empty() {
errors = new_constraints errors = new_constraints