diff --git a/crates/aiken-lang/src/tipo/infer.rs b/crates/aiken-lang/src/tipo/infer.rs index 19288ac6..6a2505e9 100644 --- a/crates/aiken-lang/src/tipo/infer.rs +++ b/crates/aiken-lang/src/tipo/infer.rs @@ -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 { 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 .map(|mut other| -> Result { 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) }) .transpose(); + + Ok(Definition::Validator(Validator { doc, end_position,