From d3997e0746ce0edc6cc686e10450216a104db1b7 Mon Sep 17 00:00:00 2001 From: TermiNexus Date: Tue, 13 Oct 2026 13:26:11 +0800 Subject: [PATCH] =?UTF-8?q?fix(gen):=20=E5=87=BD=E6=95=B0=E6=8C=87?= =?UTF-8?q?=E9=92=88=E5=8F=98=E9=87=8F=E5=88=AB=E5=90=8D=EF=BC=88f2:=20raw?= =?UTF-8?q?ptr=20=3D=20f=EF=BC=89=E7=BB=A7=E6=89=BF=E5=B7=B2=E6=B3=A8?= =?UTF-8?q?=E5=86=8C=E7=9A=84=E8=BF=94=E5=9B=9E=E7=B1=BB=E5=9E=8B=E7=AD=BE?= =?UTF-8?q?=E5=90=8D=EF=BC=8C=E4=BF=AE=20rawptr=20=E9=97=B4=E6=8E=A5?= =?UTF-8?q?=E8=B0=83=E7=94=A8=E7=9A=84=E7=AD=BE=E5=90=8D=E7=BC=BA=E5=A4=B1?= =?UTF-8?q?=20fail-fast?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App/lib/core/Gen/AssignGenMixin.vp | 10 ++++++++++ 1 file changed, 10 insertions(+) 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: