From 9826961c76feb9b33bd9ed5309a94b840f7e71f1 Mon Sep 17 00:00:00 2001 From: lisyarus Date: Thu, 18 Dec 2025 17:03:59 +0300 Subject: [PATCH] Fix unhandled cases of casting to array & function types --- libs/interpreter/source/eval.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/libs/interpreter/source/eval.cpp b/libs/interpreter/source/eval.cpp index f8fe084..a515b42 100644 --- a/libs/interpreter/source/eval.cpp +++ b/libs/interpreter/source/eval.cpp @@ -472,6 +472,18 @@ namespace pslang::interpreter return std::visit([&](auto const & type){ return cast_impl(value, type); }, type); } + template + value cast_impl(primitive_value_base const &, type::array_type const &) + { + throw std::runtime_error("Cannot cast anything to array type"); + } + + template + value cast_impl(primitive_value_base const &, type::function_type const &) + { + throw std::runtime_error("Cannot cast anything to function type"); + } + template value cast_impl(primitive_value_base const & value, type::type const & type) {