From cac919de94723111b6253bf7f994df1b1d9cac56 Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Mon, 23 Sep 2024 22:56:26 -0300 Subject: [PATCH] fix --- vlib/v/checker/checker.v | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index 562c082d06143d..40bfc7a0991c38 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -4375,7 +4375,14 @@ fn (mut c Checker) mark_as_referenced(mut node ast.Expr, as_interface bool) { node.obj.is_auto_heap = true } } - .sum_type, .interface_, .function {} + .sum_type, .interface_ {} + .function { + if type_sym.info is ast.FnType { + if type_sym.info.is_anon { + node.obj.is_auto_heap = true + } + } + } else { node.obj.is_auto_heap = true }