fix(gen): correct two latent lookup bugs exposed by the new call order
- ExprGenOps called `_lookup_module_sha1` on ExprGenAttr, but the method lives on CallGenBase. With ExprGenOps now translated before the callee's stub/text.ll is available, the receiver lookup failed with "method return type cannot be obtained precisely": `cls=ExprGenAttr ... _lookup_module_sha1`. Use `self.Gen.CallGenBase._lookup_module_sha1`. - VpiReader._lookup_vpi_ret_annot's generic-specialization fallback used `sha1_len` without declaring it. The new `list[int].set` return-type lookup reaches that fallback and failed with `NameError: undefined name 'sha1_len'`. Compute `sha1_len = strlen(src_sha1)` before the cache scan. Self-host 110/110 (two generations); ListTest, GenericTest3, PtrOpProbe and HashLibTest pass.
This commit is contained in:
1 parent
9e0729b855
commit
77e879ef18
2 files changed
+2
-1
No files matched your search
@@ -1741,6 +1741,7 @@ def _lookup_vpi_ret_annot(src_sha1: str, cls_name: str, method_name: str) -> str
|
||||
"""Look up a method's cached return-annotation string; None if not found."""
|
||||
if _g_vpi_ret_keys is None or _g_vpi_ret_count == 0: return None
|
||||
if src_sha1 is None or method_name is None: return None
|
||||
sha1_len: sizet = string.strlen(src_sha1)
|
||||
key_buf: bytes = _vpi_method_key(src_sha1, cls_name, method_name)
|
||||
if key_buf is None: return None
|
||||
i: int
|
||||
|
||||
@@ -400,7 +400,7 @@ novirtual class ExprGenOps(ExprGenBase.ExprGenBase):
|
||||
mod_path = om_buf_mg
|
||||
# package submodules (`intr.idt`) count as known when the package is imported
|
||||
if self.Gen.ImportsGen.is_module_imported_or_known(trans._imported_modules, mod_path) == 0: return None
|
||||
gv: mlirlite.GlobalVariable* = self.Gen.ExprGenAttr.find_global_in_module(trans.Module, self.Gen.FuncGenBase._mangle_name_with_sha1(self.Gen.ExprGenAttr._lookup_module_sha1(mod_path), at.attr))
|
||||
gv: mlirlite.GlobalVariable* = self.Gen.ExprGenAttr.find_global_in_module(trans.Module, self.Gen.FuncGenBase._mangle_name_with_sha1(self.Gen.CallGenBase._lookup_module_sha1(mod_path), at.attr))
|
||||
if gv is None: gv = self.Gen.ExprGenAttr.find_global_in_module(trans.Module, at.attr)
|
||||
if gv is None or gv.Ty is None: return None
|
||||
# a global is usually `Element*` / `Element**` or an array `[N]Element`: descend to the leaf type
|
||||
|
||||
Reference in new issue
Block a user