fix: infer validator args as Data if Unbound closes #649
This commit is contained in:
parent
b80c41b4b7
commit
914b8d4e74
|
@ -319,7 +319,17 @@ fn infer_definition(
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
let typed_params = typed_fun.arguments.drain(0..params_length).collect();
|
let typed_params = typed_fun.arguments
|
||||||
|
.drain(0..params_length)
|
||||||
|
.map(|mut arg| {
|
||||||
|
if arg.tipo.is_unbound() {
|
||||||
|
arg.tipo = builtins::data();
|
||||||
|
}
|
||||||
|
|
||||||
|
arg
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
|
|
||||||
|
|
||||||
if typed_fun.arguments.len() < 2 || typed_fun.arguments.len() > 3 {
|
if typed_fun.arguments.len() < 2 || typed_fun.arguments.len() > 3 {
|
||||||
return Err(Error::IncorrectValidatorArity {
|
return Err(Error::IncorrectValidatorArity {
|
||||||
|
@ -328,6 +338,12 @@ fn infer_definition(
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for arg in typed_fun.arguments.iter_mut() {
|
||||||
|
if arg.tipo.is_unbound() {
|
||||||
|
arg.tipo = builtins::data();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let typed_other_fun = other_fun
|
let typed_other_fun = other_fun
|
||||||
.map(|mut other| -> Result<TypedFunction, Error> {
|
.map(|mut other| -> Result<TypedFunction, Error> {
|
||||||
let params = params.into_iter().chain(other.arguments);
|
let params = params.into_iter().chain(other.arguments);
|
||||||
|
@ -372,10 +388,18 @@ fn infer_definition(
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for arg in other_typed_fun.arguments.iter_mut() {
|
||||||
|
if arg.tipo.is_unbound() {
|
||||||
|
arg.tipo = builtins::data();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Ok(other_typed_fun)
|
Ok(other_typed_fun)
|
||||||
})
|
})
|
||||||
.transpose();
|
.transpose();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Ok(Definition::Validator(Validator {
|
Ok(Definition::Validator(Validator {
|
||||||
doc,
|
doc,
|
||||||
end_position,
|
end_position,
|
||||||
|
|
Loading…
Reference in New Issue