From 7ee82de3123864dd2429771ccea9d6a4127a0f4d Mon Sep 17 00:00:00 2001 From: pca006132 Date: Sat, 27 Nov 2021 20:27:46 +0800 Subject: [PATCH] nac3core: fixed weird type inference error --- nac3core/src/toplevel/composer.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/nac3core/src/toplevel/composer.rs b/nac3core/src/toplevel/composer.rs index b0afaf26..a8faf130 100644 --- a/nac3core/src/toplevel/composer.rs +++ b/nac3core/src/toplevel/composer.rs @@ -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>, Option<&ast::Expr>)> = args .args .iter() @@ -1307,7 +1307,7 @@ impl TopLevelComposer { } let mut result = Vec::new(); - + let arg_with_default: Vec<(&ast::Located>, 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 {