From 8ce39719f0b100d98f89e267a74463090c3692a4 Mon Sep 17 00:00:00 2001 From: Aryan Baranwal Date: Thu, 30 Apr 2026 00:27:09 +0530 Subject: [PATCH] fix(sema): reject internal function references in abi.encode* arguments Signed-off-by: Aryan Baranwal --- src/sema/builtin.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/sema/builtin.rs b/src/sema/builtin.rs index 91d68758a..f1f112525 100644 --- a/src/sema/builtin.rs +++ b/src/sema/builtin.rs @@ -1413,6 +1413,14 @@ pub(super) fn resolve_namespace_call( return Err(()); } + if matches!(ty, Type::InternalFunction { .. }) { + diagnostics.push(Diagnostic::error( + arg.loc(), + "internal function references cannot be abi encoded".to_string(), + )); + return Err(()); + } + expr = expr.cast(&arg.loc(), ty.deref_any(), true, ns, diagnostics)?; // A string or hex literal should be encoded as a string