From 97fb066e388aaf761617fdc1ac254bec7742edfe Mon Sep 17 00:00:00 2001 From: lisyarus Date: Tue, 23 Dec 2025 12:17:18 +0300 Subject: [PATCH] Only construct zero value of built-in type if the argument count is zero --- libs/interpreter/source/eval.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/libs/interpreter/source/eval.cpp b/libs/interpreter/source/eval.cpp index 0640511..55f2997 100644 --- a/libs/interpreter/source/eval.cpp +++ b/libs/interpreter/source/eval.cpp @@ -511,7 +511,16 @@ namespace pslang::interpreter if (identifier) { if (auto type = types::builtin_type(identifier->name)) - return zero_value(context, *type); + { + if (function_call.arguments.empty()) + return zero_value(context, *type); + + std::ostringstream os; + os << "Cannot create built-in type "; + types::print(os, *type); + os << ": expected 0 arguments, but got " << function_call.arguments.size(); + throw std::runtime_error(os.str()); + } for (auto it = context.scope_stack.rbegin(); it != context.scope_stack.rend(); ++it) {