From 64a3751fc2d037da38c78d501e74423c727bc437 Mon Sep 17 00:00:00 2001 From: David Mak Date: Tue, 23 Apr 2024 14:40:18 +0800 Subject: [PATCH] core: Remove custom function type definitions for ndarray operators --- nac3core/src/toplevel/builtins.rs | 244 ------------------ nac3core/src/toplevel/helper.rs | 56 ---- ...el__test__test_analyze__generic_class.snap | 2 +- ...t__test_analyze__inheritance_override.snap | 2 +- ...est__test_analyze__list_tuple_generic.snap | 4 +- ...__toplevel__test__test_analyze__self1.snap | 2 +- ...t__test_analyze__simple_class_compose.snap | 4 +- 7 files changed, 7 insertions(+), 307 deletions(-) diff --git a/nac3core/src/toplevel/builtins.rs b/nac3core/src/toplevel/builtins.rs index a8e2ca4e1..44057093e 100644 --- a/nac3core/src/toplevel/builtins.rs +++ b/nac3core/src/toplevel/builtins.rs @@ -299,7 +299,6 @@ pub fn get_builtins(primitives: &mut (PrimitiveStore, Unifier)) -> BuiltinInfo { Some("N".into()), None, ); - let size_t = primitives.0.usize(); let var_map: VarMap = vec![(num_ty.1, num_ty.0)].into_iter().collect(); let exception_fields = vec![ @@ -347,27 +346,8 @@ pub fn get_builtins(primitives: &mut (PrimitiveStore, Unifier)) -> BuiltinInfo { .nth(1) .map(|(var_id, ty)| (*ty, *var_id)) .unwrap(); - let ndarray_usized_ndims_tvar = primitives.1.get_fresh_const_generic_var( - size_t, - Some("ndarray_ndims".into()), - None, - ); let ndarray_copy_ty = *ndarray_fields.get(&"copy".into()).unwrap(); let ndarray_fill_ty = *ndarray_fields.get(&"fill".into()).unwrap(); - let ndarray_add_ty = *ndarray_fields.get(&"__add__".into()).unwrap(); - let ndarray_sub_ty = *ndarray_fields.get(&"__sub__".into()).unwrap(); - let ndarray_mul_ty = *ndarray_fields.get(&"__mul__".into()).unwrap(); - let ndarray_truediv_ty = *ndarray_fields.get(&"__truediv__".into()).unwrap(); - let ndarray_floordiv_ty = *ndarray_fields.get(&"__floordiv__".into()).unwrap(); - let ndarray_mod_ty = *ndarray_fields.get(&"__mod__".into()).unwrap(); - let ndarray_pow_ty = *ndarray_fields.get(&"__pow__".into()).unwrap(); - let ndarray_iadd_ty = *ndarray_fields.get(&"__iadd__".into()).unwrap(); - let ndarray_isub_ty = *ndarray_fields.get(&"__isub__".into()).unwrap(); - let ndarray_imul_ty = *ndarray_fields.get(&"__imul__".into()).unwrap(); - let ndarray_itruediv_ty = *ndarray_fields.get(&"__itruediv__".into()).unwrap(); - let ndarray_ifloordiv_ty = *ndarray_fields.get(&"__ifloordiv__".into()).unwrap(); - let ndarray_imod_ty = *ndarray_fields.get(&"__imod__".into()).unwrap(); - let ndarray_ipow_ty = *ndarray_fields.get(&"__ipow__".into()).unwrap(); let top_level_def_list = vec![ Arc::new(RwLock::new(TopLevelComposer::make_top_level_class_def( @@ -545,20 +525,6 @@ pub fn get_builtins(primitives: &mut (PrimitiveStore, Unifier)) -> BuiltinInfo { methods: vec![ ("copy".into(), ndarray_copy_ty.0, DefinitionId(PRIMITIVE_DEF_IDS.ndarray.0 + 1)), ("fill".into(), ndarray_fill_ty.0, DefinitionId(PRIMITIVE_DEF_IDS.ndarray.0 + 2)), - ("__add__".into(), ndarray_add_ty.0, DefinitionId(PRIMITIVE_DEF_IDS.ndarray.0 + 3)), - ("__sub__".into(), ndarray_sub_ty.0, DefinitionId(PRIMITIVE_DEF_IDS.ndarray.0 + 4)), - ("__mul__".into(), ndarray_mul_ty.0, DefinitionId(PRIMITIVE_DEF_IDS.ndarray.0 + 5)), - ("__truediv__".into(), ndarray_mul_ty.0, DefinitionId(PRIMITIVE_DEF_IDS.ndarray.0 + 6)), - ("__floordiv__".into(), ndarray_mul_ty.0, DefinitionId(PRIMITIVE_DEF_IDS.ndarray.0 + 7)), - ("__mod__".into(), ndarray_mul_ty.0, DefinitionId(PRIMITIVE_DEF_IDS.ndarray.0 + 8)), - ("__pow__".into(), ndarray_mul_ty.0, DefinitionId(PRIMITIVE_DEF_IDS.ndarray.0 + 9)), - ("__iadd__".into(), ndarray_iadd_ty.0, DefinitionId(PRIMITIVE_DEF_IDS.ndarray.0 + 10)), - ("__isub__".into(), ndarray_isub_ty.0, DefinitionId(PRIMITIVE_DEF_IDS.ndarray.0 + 11)), - ("__imul__".into(), ndarray_imul_ty.0, DefinitionId(PRIMITIVE_DEF_IDS.ndarray.0 + 12)), - ("__itruediv__".into(), ndarray_mul_ty.0, DefinitionId(PRIMITIVE_DEF_IDS.ndarray.0 + 13)), - ("__ifloordiv__".into(), ndarray_mul_ty.0, DefinitionId(PRIMITIVE_DEF_IDS.ndarray.0 + 14)), - ("__imod__".into(), ndarray_mul_ty.0, DefinitionId(PRIMITIVE_DEF_IDS.ndarray.0 + 15)), - ("__ipow__".into(), ndarray_imul_ty.0, DefinitionId(PRIMITIVE_DEF_IDS.ndarray.0 + 16)), ], ancestors: Vec::default(), constructor: None, @@ -597,216 +563,6 @@ pub fn get_builtins(primitives: &mut (PrimitiveStore, Unifier)) -> BuiltinInfo { )))), loc: None, })), - Arc::new(RwLock::new(TopLevelDef::Function { - name: "ndarray.__add__".into(), - simple_name: "__add__".into(), - signature: ndarray_add_ty.0, - var_id: vec![ndarray_dtype_var_id, ndarray_ndims_var_id], - instance_to_symbol: HashMap::default(), - instance_to_stmt: HashMap::default(), - resolver: None, - codegen_callback: Some(Arc::new(GenCall::new(Box::new( - |_, _, _, _, _| { - unreachable!("handled in gen_expr") - }, - )))), - loc: None, - })), - Arc::new(RwLock::new(TopLevelDef::Function { - name: "ndarray.__sub__".into(), - simple_name: "__sub__".into(), - signature: ndarray_sub_ty.0, - var_id: vec![ndarray_dtype_var_id, ndarray_ndims_var_id], - instance_to_symbol: HashMap::default(), - instance_to_stmt: HashMap::default(), - resolver: None, - codegen_callback: Some(Arc::new(GenCall::new(Box::new( - |_, _, _, _, _| { - unreachable!("handled in gen_expr") - }, - )))), - loc: None, - })), - Arc::new(RwLock::new(TopLevelDef::Function { - name: "ndarray.__mul__".into(), - simple_name: "__mul__".into(), - signature: ndarray_mul_ty.0, - var_id: vec![ndarray_dtype_var_id, ndarray_ndims_var_id], - instance_to_symbol: HashMap::default(), - instance_to_stmt: HashMap::default(), - resolver: None, - codegen_callback: Some(Arc::new(GenCall::new(Box::new( - |_, _, _, _, _| { - unreachable!("handled in gen_expr") - }, - )))), - loc: None, - })), - Arc::new(RwLock::new(TopLevelDef::Function { - name: "ndarray.__truediv__".into(), - simple_name: "__truediv__".into(), - signature: ndarray_truediv_ty.0, - var_id: vec![ndarray_dtype_var_id, ndarray_ndims_var_id], - instance_to_symbol: HashMap::default(), - instance_to_stmt: HashMap::default(), - resolver: None, - codegen_callback: Some(Arc::new(GenCall::new(Box::new( - |_, _, _, _, _| { - unreachable!("handled in gen_expr") - }, - )))), - loc: None, - })), - Arc::new(RwLock::new(TopLevelDef::Function { - name: "ndarray.__floordiv__".into(), - simple_name: "__floordiv__".into(), - signature: ndarray_floordiv_ty.0, - var_id: vec![ndarray_dtype_var_id, ndarray_ndims_var_id], - instance_to_symbol: HashMap::default(), - instance_to_stmt: HashMap::default(), - resolver: None, - codegen_callback: Some(Arc::new(GenCall::new(Box::new( - |_, _, _, _, _| { - unreachable!("handled in gen_expr") - }, - )))), - loc: None, - })), - Arc::new(RwLock::new(TopLevelDef::Function { - name: "ndarray.__mod__".into(), - simple_name: "__mod__".into(), - signature: ndarray_mod_ty.0, - var_id: vec![ndarray_dtype_var_id, ndarray_ndims_var_id], - instance_to_symbol: HashMap::default(), - instance_to_stmt: HashMap::default(), - resolver: None, - codegen_callback: Some(Arc::new(GenCall::new(Box::new( - |_, _, _, _, _| { - unreachable!("handled in gen_expr") - }, - )))), - loc: None, - })), - Arc::new(RwLock::new(TopLevelDef::Function { - name: "ndarray.__pow__".into(), - simple_name: "__pow__".into(), - signature: ndarray_pow_ty.0, - var_id: vec![ndarray_dtype_var_id, ndarray_ndims_var_id], - instance_to_symbol: HashMap::default(), - instance_to_stmt: HashMap::default(), - resolver: None, - codegen_callback: Some(Arc::new(GenCall::new(Box::new( - |_, _, _, _, _| { - unreachable!("handled in gen_expr") - }, - )))), - loc: None, - })), - Arc::new(RwLock::new(TopLevelDef::Function { - name: "ndarray.__iadd__".into(), - simple_name: "__iadd__".into(), - signature: ndarray_iadd_ty.0, - var_id: vec![ndarray_dtype_var_id, ndarray_ndims_var_id, ndarray_usized_ndims_tvar.1], - instance_to_symbol: HashMap::default(), - instance_to_stmt: HashMap::default(), - resolver: None, - codegen_callback: Some(Arc::new(GenCall::new(Box::new( - |_, _, _, _, _| { - unreachable!("handled in gen_expr") - }, - )))), - loc: None, - })), - Arc::new(RwLock::new(TopLevelDef::Function { - name: "ndarray.__isub__".into(), - simple_name: "__isub__".into(), - signature: ndarray_isub_ty.0, - var_id: vec![ndarray_dtype_var_id, ndarray_ndims_var_id], - instance_to_symbol: HashMap::default(), - instance_to_stmt: HashMap::default(), - resolver: None, - codegen_callback: Some(Arc::new(GenCall::new(Box::new( - |_, _, _, _, _| { - unreachable!("handled in gen_expr") - }, - )))), - loc: None, - })), - Arc::new(RwLock::new(TopLevelDef::Function { - name: "ndarray.__imul__".into(), - simple_name: "__imul__".into(), - signature: ndarray_imul_ty.0, - var_id: vec![ndarray_dtype_var_id, ndarray_ndims_var_id], - instance_to_symbol: HashMap::default(), - instance_to_stmt: HashMap::default(), - resolver: None, - codegen_callback: Some(Arc::new(GenCall::new(Box::new( - |_, _, _, _, _| { - unreachable!("handled in gen_expr") - }, - )))), - loc: None, - })), - Arc::new(RwLock::new(TopLevelDef::Function { - name: "ndarray.__itruediv__".into(), - simple_name: "__itruediv__".into(), - signature: ndarray_itruediv_ty.0, - var_id: vec![ndarray_dtype_var_id, ndarray_ndims_var_id], - instance_to_symbol: HashMap::default(), - instance_to_stmt: HashMap::default(), - resolver: None, - codegen_callback: Some(Arc::new(GenCall::new(Box::new( - |_, _, _, _, _| { - unreachable!("handled in gen_expr") - }, - )))), - loc: None, - })), - Arc::new(RwLock::new(TopLevelDef::Function { - name: "ndarray.__ifloordiv__".into(), - simple_name: "__ifloordiv__".into(), - signature: ndarray_ifloordiv_ty.0, - var_id: vec![ndarray_dtype_var_id, ndarray_ndims_var_id], - instance_to_symbol: HashMap::default(), - instance_to_stmt: HashMap::default(), - resolver: None, - codegen_callback: Some(Arc::new(GenCall::new(Box::new( - |_, _, _, _, _| { - unreachable!("handled in gen_expr") - }, - )))), - loc: None, - })), - Arc::new(RwLock::new(TopLevelDef::Function { - name: "ndarray.__imod__".into(), - simple_name: "__imod__".into(), - signature: ndarray_imod_ty.0, - var_id: vec![ndarray_dtype_var_id, ndarray_ndims_var_id], - instance_to_symbol: HashMap::default(), - instance_to_stmt: HashMap::default(), - resolver: None, - codegen_callback: Some(Arc::new(GenCall::new(Box::new( - |_, _, _, _, _| { - unreachable!("handled in gen_expr") - }, - )))), - loc: None, - })), - Arc::new(RwLock::new(TopLevelDef::Function { - name: "ndarray.__ipow__".into(), - simple_name: "__ipow__".into(), - signature: ndarray_ipow_ty.0, - var_id: vec![ndarray_dtype_var_id, ndarray_ndims_var_id], - instance_to_symbol: HashMap::default(), - instance_to_stmt: HashMap::default(), - resolver: None, - codegen_callback: Some(Arc::new(GenCall::new(Box::new( - |_, _, _, _, _| { - unreachable!("handled in gen_expr") - }, - )))), - loc: None, - })), Arc::new(RwLock::new(TopLevelDef::Function { name: "int32".into(), simple_name: "int32".into(), diff --git a/nac3core/src/toplevel/helper.rs b/nac3core/src/toplevel/helper.rs index 33f6d48d8..e212ac8b5 100644 --- a/nac3core/src/toplevel/helper.rs +++ b/nac3core/src/toplevel/helper.rs @@ -1,7 +1,6 @@ use std::convert::TryInto; use crate::symbol_resolver::SymbolValue; -use crate::toplevel::numpy::subst_ndarray_tvars; use crate::typecheck::typedef::{Mapping, VarMap}; use nac3parser::ast::{Constant, Location}; @@ -232,57 +231,11 @@ impl TopLevelComposer { (ndarray_ndims_tvar.1, ndarray_ndims_tvar.0), ]), })); - let ndarray_binop_fun_other_ty = unifier.get_fresh_var(None, None); - let ndarray_binop_fun_ret_ty = unifier.get_fresh_var(None, None); - let ndarray_binop_fun_ty = unifier.add_ty(TypeEnum::TFunc(FunSignature { - args: vec![ - FuncArg { - name: "other".into(), - ty: ndarray_binop_fun_other_ty.0, - default_value: None, - }, - ], - ret: ndarray_binop_fun_ret_ty.0, - vars: VarMap::from([ - (ndarray_dtype_tvar.1, ndarray_dtype_tvar.0), - (ndarray_ndims_tvar.1, ndarray_ndims_tvar.0), - ]), - })); - let ndarray_truediv_fun_other_ty = unifier.get_fresh_var(None, None); - let ndarray_truediv_fun_ret_ty = unifier.get_fresh_var(None, None); - let ndarray_truediv_fun_ty = unifier.add_ty(TypeEnum::TFunc(FunSignature { - args: vec![ - FuncArg { - name: "other".into(), - ty: ndarray_truediv_fun_other_ty.0, - default_value: None, - }, - ], - ret: ndarray_truediv_fun_ret_ty.0, - vars: VarMap::from([ - (ndarray_dtype_tvar.1, ndarray_dtype_tvar.0), - (ndarray_ndims_tvar.1, ndarray_ndims_tvar.0), - ]), - })); let ndarray = unifier.add_ty(TypeEnum::TObj { obj_id: PRIMITIVE_DEF_IDS.ndarray, fields: Mapping::from([ ("copy".into(), (ndarray_copy_fun_ty, true)), ("fill".into(), (ndarray_fill_fun_ty, true)), - ("__add__".into(), (ndarray_binop_fun_ty, true)), - ("__sub__".into(), (ndarray_binop_fun_ty, true)), - ("__mul__".into(), (ndarray_binop_fun_ty, true)), - ("__truediv__".into(), (ndarray_truediv_fun_ty, true)), - ("__floordiv__".into(), (ndarray_binop_fun_ty, true)), - ("__mod__".into(), (ndarray_binop_fun_ty, true)), - ("__pow__".into(), (ndarray_binop_fun_ty, true)), - ("__iadd__".into(), (ndarray_binop_fun_ty, true)), - ("__isub__".into(), (ndarray_binop_fun_ty, true)), - ("__imul__".into(), (ndarray_binop_fun_ty, true)), - ("__itruediv__".into(), (ndarray_truediv_fun_ty, true)), - ("__ifloordiv__".into(), (ndarray_binop_fun_ty, true)), - ("__imod__".into(), (ndarray_binop_fun_ty, true)), - ("__ipow__".into(), (ndarray_binop_fun_ty, true)), ]), params: VarMap::from([ (ndarray_dtype_tvar.1, ndarray_dtype_tvar.0), @@ -290,16 +243,7 @@ impl TopLevelComposer { ]), }); - let ndarray_usized_ndims_tvar = unifier.get_fresh_const_generic_var(size_t_ty, Some("ndarray_ndims".into()), None); - let ndarray_unsized = subst_ndarray_tvars(&mut unifier, ndarray, Some(ndarray_usized_ndims_tvar.0), None); - unifier.unify(ndarray_copy_fun_ret_ty.0, ndarray).unwrap(); - unifier.unify(ndarray_binop_fun_other_ty.0, ndarray_unsized).unwrap(); - unifier.unify(ndarray_binop_fun_ret_ty.0, ndarray).unwrap(); - - let ndarray_float = subst_ndarray_tvars(&mut unifier, ndarray, Some(float), None); - unifier.unify(ndarray_truediv_fun_other_ty.0, ndarray).unwrap(); - unifier.unify(ndarray_truediv_fun_ret_ty.0, ndarray_float).unwrap(); let primitives = PrimitiveStore { int32, diff --git a/nac3core/src/toplevel/snapshots/nac3core__toplevel__test__test_analyze__generic_class.snap b/nac3core/src/toplevel/snapshots/nac3core__toplevel__test__test_analyze__generic_class.snap index 415a98e1e..a9dc4ad1c 100644 --- a/nac3core/src/toplevel/snapshots/nac3core__toplevel__test__test_analyze__generic_class.snap +++ b/nac3core/src/toplevel/snapshots/nac3core__toplevel__test__test_analyze__generic_class.snap @@ -5,7 +5,7 @@ expression: res_vec [ "Class {\nname: \"Generic_A\",\nancestors: [\"Generic_A[V]\", \"B\"],\nfields: [\"aa\", \"a\"],\nmethods: [(\"__init__\", \"fn[[], none]\"), (\"foo\", \"fn[[b:T], none]\"), (\"fun\", \"fn[[a:int32], V]\")],\ntype_vars: [\"V\"]\n}\n", "Function {\nname: \"Generic_A.__init__\",\nsig: \"fn[[], none]\",\nvar_id: []\n}\n", - "Function {\nname: \"Generic_A.fun\",\nsig: \"fn[[a:int32], V]\",\nvar_id: [156]\n}\n", + "Function {\nname: \"Generic_A.fun\",\nsig: \"fn[[a:int32], V]\",\nvar_id: [127]\n}\n", "Class {\nname: \"B\",\nancestors: [\"B\"],\nfields: [\"aa\"],\nmethods: [(\"__init__\", \"fn[[], none]\"), (\"foo\", \"fn[[b:T], none]\")],\ntype_vars: []\n}\n", "Function {\nname: \"B.__init__\",\nsig: \"fn[[], none]\",\nvar_id: []\n}\n", "Function {\nname: \"B.foo\",\nsig: \"fn[[b:T], none]\",\nvar_id: []\n}\n", diff --git a/nac3core/src/toplevel/snapshots/nac3core__toplevel__test__test_analyze__inheritance_override.snap b/nac3core/src/toplevel/snapshots/nac3core__toplevel__test__test_analyze__inheritance_override.snap index 41b317822..dc36b54b9 100644 --- a/nac3core/src/toplevel/snapshots/nac3core__toplevel__test__test_analyze__inheritance_override.snap +++ b/nac3core/src/toplevel/snapshots/nac3core__toplevel__test__test_analyze__inheritance_override.snap @@ -7,7 +7,7 @@ expression: res_vec "Function {\nname: \"A.__init__\",\nsig: \"fn[[t:T], none]\",\nvar_id: []\n}\n", "Function {\nname: \"A.fun\",\nsig: \"fn[[a:int32, b:T], list[virtual[B[bool]]]]\",\nvar_id: []\n}\n", "Function {\nname: \"A.foo\",\nsig: \"fn[[c:C], none]\",\nvar_id: []\n}\n", - "Class {\nname: \"B\",\nancestors: [\"B[typevar145]\", \"A[float]\"],\nfields: [\"a\", \"b\", \"c\", \"d\"],\nmethods: [(\"__init__\", \"fn[[], none]\"), (\"fun\", \"fn[[a:int32, b:T], list[virtual[B[bool]]]]\"), (\"foo\", \"fn[[c:C], none]\")],\ntype_vars: [\"typevar145\"]\n}\n", + "Class {\nname: \"B\",\nancestors: [\"B[typevar116]\", \"A[float]\"],\nfields: [\"a\", \"b\", \"c\", \"d\"],\nmethods: [(\"__init__\", \"fn[[], none]\"), (\"fun\", \"fn[[a:int32, b:T], list[virtual[B[bool]]]]\"), (\"foo\", \"fn[[c:C], none]\")],\ntype_vars: [\"typevar116\"]\n}\n", "Function {\nname: \"B.__init__\",\nsig: \"fn[[], none]\",\nvar_id: []\n}\n", "Function {\nname: \"B.fun\",\nsig: \"fn[[a:int32, b:T], list[virtual[B[bool]]]]\",\nvar_id: []\n}\n", "Class {\nname: \"C\",\nancestors: [\"C\", \"B[bool]\", \"A[float]\"],\nfields: [\"a\", \"b\", \"c\", \"d\", \"e\"],\nmethods: [(\"__init__\", \"fn[[], none]\"), (\"fun\", \"fn[[a:int32, b:T], list[virtual[B[bool]]]]\"), (\"foo\", \"fn[[c:C], none]\")],\ntype_vars: []\n}\n", diff --git a/nac3core/src/toplevel/snapshots/nac3core__toplevel__test__test_analyze__list_tuple_generic.snap b/nac3core/src/toplevel/snapshots/nac3core__toplevel__test__test_analyze__list_tuple_generic.snap index f705da720..d6adcee10 100644 --- a/nac3core/src/toplevel/snapshots/nac3core__toplevel__test__test_analyze__list_tuple_generic.snap +++ b/nac3core/src/toplevel/snapshots/nac3core__toplevel__test__test_analyze__list_tuple_generic.snap @@ -5,8 +5,8 @@ expression: res_vec [ "Function {\nname: \"foo\",\nsig: \"fn[[a:list[int32], b:tuple[T, float]], A[B, bool]]\",\nvar_id: []\n}\n", "Class {\nname: \"A\",\nancestors: [\"A[T, V]\"],\nfields: [\"a\", \"b\"],\nmethods: [(\"__init__\", \"fn[[v:V], none]\"), (\"fun\", \"fn[[a:T], V]\")],\ntype_vars: [\"T\", \"V\"]\n}\n", - "Function {\nname: \"A.__init__\",\nsig: \"fn[[v:V], none]\",\nvar_id: [158]\n}\n", - "Function {\nname: \"A.fun\",\nsig: \"fn[[a:T], V]\",\nvar_id: [163]\n}\n", + "Function {\nname: \"A.__init__\",\nsig: \"fn[[v:V], none]\",\nvar_id: [129]\n}\n", + "Function {\nname: \"A.fun\",\nsig: \"fn[[a:T], V]\",\nvar_id: [134]\n}\n", "Function {\nname: \"gfun\",\nsig: \"fn[[a:A[list[float], int32]], none]\",\nvar_id: []\n}\n", "Class {\nname: \"B\",\nancestors: [\"B\"],\nfields: [],\nmethods: [(\"__init__\", \"fn[[], none]\")],\ntype_vars: []\n}\n", "Function {\nname: \"B.__init__\",\nsig: \"fn[[], none]\",\nvar_id: []\n}\n", diff --git a/nac3core/src/toplevel/snapshots/nac3core__toplevel__test__test_analyze__self1.snap b/nac3core/src/toplevel/snapshots/nac3core__toplevel__test__test_analyze__self1.snap index 79520bafe..55767a80c 100644 --- a/nac3core/src/toplevel/snapshots/nac3core__toplevel__test__test_analyze__self1.snap +++ b/nac3core/src/toplevel/snapshots/nac3core__toplevel__test__test_analyze__self1.snap @@ -3,7 +3,7 @@ source: nac3core/src/toplevel/test.rs expression: res_vec --- [ - "Class {\nname: \"A\",\nancestors: [\"A[typevar144, typevar145]\"],\nfields: [\"a\", \"b\"],\nmethods: [(\"__init__\", \"fn[[a:A[float, bool], b:B], none]\"), (\"fun\", \"fn[[a:A[float, bool]], A[bool, int32]]\")],\ntype_vars: [\"typevar144\", \"typevar145\"]\n}\n", + "Class {\nname: \"A\",\nancestors: [\"A[typevar115, typevar116]\"],\nfields: [\"a\", \"b\"],\nmethods: [(\"__init__\", \"fn[[a:A[float, bool], b:B], none]\"), (\"fun\", \"fn[[a:A[float, bool]], A[bool, int32]]\")],\ntype_vars: [\"typevar115\", \"typevar116\"]\n}\n", "Function {\nname: \"A.__init__\",\nsig: \"fn[[a:A[float, bool], b:B], none]\",\nvar_id: []\n}\n", "Function {\nname: \"A.fun\",\nsig: \"fn[[a:A[float, bool]], A[bool, int32]]\",\nvar_id: []\n}\n", "Class {\nname: \"B\",\nancestors: [\"B\", \"A[int64, bool]\"],\nfields: [\"a\", \"b\"],\nmethods: [(\"__init__\", \"fn[[], none]\"), (\"fun\", \"fn[[a:A[float, bool]], A[bool, int32]]\"), (\"foo\", \"fn[[b:B], B]\"), (\"bar\", \"fn[[a:A[list[B], int32]], tuple[A[virtual[A[B, int32]], bool], B]]\")],\ntype_vars: []\n}\n", diff --git a/nac3core/src/toplevel/snapshots/nac3core__toplevel__test__test_analyze__simple_class_compose.snap b/nac3core/src/toplevel/snapshots/nac3core__toplevel__test__test_analyze__simple_class_compose.snap index eee42f41a..f4f96f2d6 100644 --- a/nac3core/src/toplevel/snapshots/nac3core__toplevel__test__test_analyze__simple_class_compose.snap +++ b/nac3core/src/toplevel/snapshots/nac3core__toplevel__test__test_analyze__simple_class_compose.snap @@ -6,12 +6,12 @@ expression: res_vec "Class {\nname: \"A\",\nancestors: [\"A\"],\nfields: [\"a\"],\nmethods: [(\"__init__\", \"fn[[], none]\"), (\"fun\", \"fn[[b:B], none]\"), (\"foo\", \"fn[[a:T, b:V], none]\")],\ntype_vars: []\n}\n", "Function {\nname: \"A.__init__\",\nsig: \"fn[[], none]\",\nvar_id: []\n}\n", "Function {\nname: \"A.fun\",\nsig: \"fn[[b:B], none]\",\nvar_id: []\n}\n", - "Function {\nname: \"A.foo\",\nsig: \"fn[[a:T, b:V], none]\",\nvar_id: [164]\n}\n", + "Function {\nname: \"A.foo\",\nsig: \"fn[[a:T, b:V], none]\",\nvar_id: [135]\n}\n", "Class {\nname: \"B\",\nancestors: [\"B\", \"C\", \"A\"],\nfields: [\"a\"],\nmethods: [(\"__init__\", \"fn[[], none]\"), (\"fun\", \"fn[[b:B], none]\"), (\"foo\", \"fn[[a:T, b:V], none]\")],\ntype_vars: []\n}\n", "Function {\nname: \"B.__init__\",\nsig: \"fn[[], none]\",\nvar_id: []\n}\n", "Class {\nname: \"C\",\nancestors: [\"C\", \"A\"],\nfields: [\"a\"],\nmethods: [(\"__init__\", \"fn[[], none]\"), (\"fun\", \"fn[[b:B], none]\"), (\"foo\", \"fn[[a:T, b:V], none]\")],\ntype_vars: []\n}\n", "Function {\nname: \"C.__init__\",\nsig: \"fn[[], none]\",\nvar_id: []\n}\n", "Function {\nname: \"C.fun\",\nsig: \"fn[[b:B], none]\",\nvar_id: []\n}\n", "Function {\nname: \"foo\",\nsig: \"fn[[a:A], none]\",\nvar_id: []\n}\n", - "Function {\nname: \"ff\",\nsig: \"fn[[a:T], V]\",\nvar_id: [172]\n}\n", + "Function {\nname: \"ff\",\nsig: \"fn[[a:T], V]\",\nvar_id: [143]\n}\n", ]