From 49476d06e1eeba59ffbf025af134d600ca317827 Mon Sep 17 00:00:00 2001 From: ychenfo Date: Mon, 22 Nov 2021 15:06:16 +0800 Subject: [PATCH] nac3core: clearer comments --- nac3core/src/codegen/concrete_type.rs | 5 +++-- nac3core/src/typecheck/typedef/mod.rs | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/nac3core/src/codegen/concrete_type.rs b/nac3core/src/codegen/concrete_type.rs index 422e4df..140142e 100644 --- a/nac3core/src/codegen/concrete_type.rs +++ b/nac3core/src/codegen/concrete_type.rs @@ -148,8 +148,9 @@ impl ConcreteTypeStore { .borrow() .iter() .filter_map(|(name, ty)| { - // filter out functions as they can have type vars and - // will not affect codegen + // here we should not have type vars, but some partial instantiated + // class methods can still have uninstantiated type vars, so + // filter out all the methods, as this will not affect codegen if let TypeEnum::TFunc( .. ) = &*unifier.get_ty(ty.0) { None } else { diff --git a/nac3core/src/typecheck/typedef/mod.rs b/nac3core/src/typecheck/typedef/mod.rs index 85e619c..0d194b2 100644 --- a/nac3core/src/typecheck/typedef/mod.rs +++ b/nac3core/src/typecheck/typedef/mod.rs @@ -725,8 +725,9 @@ impl Unifier { if let TypeEnum::TVar { id, range, .. } = self.unification_table.probe_value(*v).as_ref() { - // need to do this for partial instantiated function - // (in class methods that contains type vars not in class) + // for class methods that contain type vars not in class declaration, + // as long as there exits one uninstantiated type var, the function is not instantiated, + // and need to do substitution on those type vars if k == id { instantiated = false; vars.push((*k, range.clone()));