λ Support functions! #5
1
examples/basic/test0003.ngr
Normal file
1
examples/basic/test0003.ngr
Normal file
@@ -0,0 +1 @@
|
|||||||
|
v = -2370389138213399653i64;
|
||||||
4
examples/basic/test0004.ngr
Normal file
4
examples/basic/test0004.ngr
Normal 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;
|
||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user