From ff674175011b317b1aa4008ddbc53224e7717fa8 Mon Sep 17 00:00:00 2001 From: Swastik Date: Mon, 7 Oct 2024 13:05:10 +0530 Subject: [PATCH] improve check --- vlib/v/checker/comptime.v | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/vlib/v/checker/comptime.v b/vlib/v/checker/comptime.v index 2fc0da096ce766..e448558ae31430 100644 --- a/vlib/v/checker/comptime.v +++ b/vlib/v/checker/comptime.v @@ -326,16 +326,16 @@ fn (mut c Checker) comptime_for(mut node ast.ComptimeFor) { c.pop_comptime_info() } } else if node.kind == .params { - if sym.kind == .function { + if !(sym.kind == .function || sym.name == 'FunctionData') { + c.error('iterating over `.params` is supported only for functions, and `${sym.name}` is not a function', + node.typ_pos) + return + } else { c.push_new_comptime_info() c.comptime.inside_comptime_for = true c.comptime.comptime_for_method_param_var = node.val_var c.stmts(mut node.stmts) c.pop_comptime_info() - } else { - c.error('iterating over `.params` is supported only for functions, and `${sym.name}` is not a function', - node.typ_pos) - return } } else if node.kind == .variants { if c.variant_data_type == 0 {