diff --git a/App/lib/core/Gen/AssignGenMixin.vp b/App/lib/core/Gen/AssignGenMixin.vp index ee651fa..fa1dc10 100644 --- a/App/lib/core/Gen/AssignGenMixin.vp +++ b/App/lib/core/Gen/AssignGenMixin.vp @@ -2129,6 +2129,16 @@ novirtual class AssignGenMixin: if callable_ret is not None: # Nonzero return already reported inside register_func_ptr_sig; this branch is defensive if self.Gen.CallGenLeafKit.register_func_ptr_sig(pool, nm.id, callable_ret, aa) != 0: return 0 + elif aa.value is not None and aa.value.kind() == ast.ASTKind.Name: + # Function-pointer alias: `f2: rawptr = f` inherits f's already-registered return + # type, so a later indirect call `f2()` can rebuild the callee type. The `rawptr` + # annotation carries no callable information of its own, and without this the indirect + # call would fail fast (see _translate_func_ptr_call's "not registered" error). + src_nm: ast.Name* = ast.Name*(aa.value) + if src_nm.id is not None: + src_ret: mlirlite.LLVMType* = self.Gen.CallGenLeafKit.lookup_func_ptr_ret(src_nm.id) + if src_ret is not None: + if self.Gen.CallGenLeafKit.register_func_ptr_sig(pool, nm.id, src_ret, aa) != 0: return 0 # Value-position volatile call prefix: mark the result slot volatile if aa.value is not None and aa.value.kind() == ast.ASTKind.Call and (ast.Call*(aa.value)).IsVolatile != 0 and nm.id is not None: