From 888696477624f01462376acb397cce4455e616d0 Mon Sep 17 00:00:00 2001 From: David Mak Date: Wed, 13 Dec 2023 18:27:06 +0800 Subject: [PATCH] core: Remove redundant argument in type annotation parsing --- nac3core/src/toplevel/composer.rs | 6 ------ nac3core/src/toplevel/type_annotation.rs | 7 ------- nac3standalone/src/main.rs | 2 -- 3 files changed, 15 deletions(-) diff --git a/nac3core/src/toplevel/composer.rs b/nac3core/src/toplevel/composer.rs index 68cfb72a7..8e612a639 100644 --- a/nac3core/src/toplevel/composer.rs +++ b/nac3core/src/toplevel/composer.rs @@ -563,7 +563,6 @@ impl TopLevelComposer { &primitive_types, b, vec![(*class_def_id, class_type_vars.clone())].into_iter().collect(), - None, )?; if let TypeAnnotation::CustomClass { .. } = &base_ty { @@ -904,7 +903,6 @@ impl TopLevelComposer { // NOTE: since only class need this, for function // it should be fine to be empty map HashMap::new(), - None, )?; let type_vars_within = @@ -971,7 +969,6 @@ impl TopLevelComposer { // NOTE: since only class need this, for function // it should be fine to be empty map HashMap::new(), - None, )? }; @@ -1158,7 +1155,6 @@ impl TopLevelComposer { vec![(class_id, class_type_vars_def.clone())] .into_iter() .collect(), - None, )? }; // find type vars within this method parameter type annotation @@ -1224,7 +1220,6 @@ impl TopLevelComposer { primitives, result, vec![(class_id, class_type_vars_def.clone())].into_iter().collect(), - None, )?; // find type vars within this return type annotation let type_vars_within = @@ -1319,7 +1314,6 @@ impl TopLevelComposer { primitives, annotation.as_ref(), vec![(class_id, class_type_vars_def.clone())].into_iter().collect(), - None, )?; // find type vars within this return type annotation let type_vars_within = diff --git a/nac3core/src/toplevel/type_annotation.rs b/nac3core/src/toplevel/type_annotation.rs index d44597cde..3cd2f25d9 100644 --- a/nac3core/src/toplevel/type_annotation.rs +++ b/nac3core/src/toplevel/type_annotation.rs @@ -74,7 +74,6 @@ pub fn parse_ast_to_type_annotation_kinds( expr: &ast::Expr, // the key stores the type_var of this topleveldef::class, we only need this field here locked: HashMap>, - type_var: Option, ) -> Result> { let name_handle = |id: &StrRef, unifier: &mut Unifier, @@ -195,7 +194,6 @@ pub fn parse_ast_to_type_annotation_kinds( locked.insert(obj_id, type_vars.clone()); locked.clone() }, - None, ) }) .collect::, _>>()?; @@ -231,7 +229,6 @@ pub fn parse_ast_to_type_annotation_kinds( primitives, slice.as_ref(), locked, - None, )?; if !matches!(def, TypeAnnotation::CustomClass { .. }) { unreachable!("must be concretized custom class kind in the virtual") @@ -252,7 +249,6 @@ pub fn parse_ast_to_type_annotation_kinds( primitives, slice.as_ref(), locked, - None, )?; Ok(TypeAnnotation::List(def_ann.into())) } @@ -270,7 +266,6 @@ pub fn parse_ast_to_type_annotation_kinds( primitives, slice.as_ref(), locked, - None, )?; let id = if let TypeEnum::TObj { obj_id, .. } = unifier.get_ty(primitives.option).as_ref() { @@ -304,7 +299,6 @@ pub fn parse_ast_to_type_annotation_kinds( primitives, e, locked.clone(), - None, ) }) .collect::, _>>()?; @@ -337,7 +331,6 @@ pub fn parse_ast_to_type_annotation_kinds( primitives, e, locked.clone(), - None, ), } }) diff --git a/nac3standalone/src/main.rs b/nac3standalone/src/main.rs index f34f55a80..eb746a8a1 100644 --- a/nac3standalone/src/main.rs +++ b/nac3standalone/src/main.rs @@ -104,7 +104,6 @@ fn handle_typevar_definition( primitives, x, HashMap::default(), - None, )?; get_type_from_type_annotation_kinds( def_list, unifier, &ty, &mut None @@ -146,7 +145,6 @@ fn handle_typevar_definition( primitives, &args[1], HashMap::default(), - None, )?; let constraint = get_type_from_type_annotation_kinds( def_list, unifier, &ty, &mut None