nac3core: fixed weird type inference error

This commit is contained in:
pca006132 2021-11-27 20:27:46 +08:00
parent 0ae1fe82b4
commit 7ee82de312

View File

@ -195,7 +195,7 @@ impl TopLevelComposer {
signature: primitives.1.add_ty(TypeEnum::TFunc(RefCell::new(FunSignature {
args: vec![FuncArg { name: "_".into(), ty: num_ty.0, default_value: None }],
ret: float,
vars: var_map,
vars: var_map.clone(),
}))),
var_id: Default::default(),
instance_to_symbol: Default::default(),
@ -398,7 +398,7 @@ impl TopLevelComposer {
signature: primitives.1.add_ty(TypeEnum::TFunc(RefCell::new(FunSignature {
args: vec![FuncArg { name: "_".into(), ty: num_ty.0, default_value: None }],
ret: primitives.0.bool,
vars: Default::default(),
vars: var_map,
}))),
var_id: Default::default(),
instance_to_symbol: Default::default(),
@ -1066,7 +1066,7 @@ impl TopLevelComposer {
and names thould not be the same as the keywords"
.into());
}
let arg_with_default: Vec<(&ast::Located<ast::ArgData<()>>, Option<&ast::Expr>)> = args
.args
.iter()
@ -1307,7 +1307,7 @@ impl TopLevelComposer {
}
let mut result = Vec::new();
let arg_with_default: Vec<(&ast::Located<ast::ArgData<()>>, Option<&ast::Expr>)> = args
.args
.iter()
@ -1319,7 +1319,7 @@ impl TopLevelComposer {
.map(|x| -> Option<&ast::Expr> { Some(x) })
.chain(std::iter::repeat(None))
).collect_vec();
for (x, default) in arg_with_default.into_iter().rev() {
let name = x.node.arg;
if name != zelf {