From ac22b4822a5991fcd52076189de1cca292b0a822 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Feb 2026 22:24:24 +0000 Subject: [PATCH] Add explanatory comment for parameter count validation Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com> --- src/ast/datatype_decl_plugin.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ast/datatype_decl_plugin.cpp b/src/ast/datatype_decl_plugin.cpp index 8a4a0957c..f35de982d 100644 --- a/src/ast/datatype_decl_plugin.cpp +++ b/src/ast/datatype_decl_plugin.cpp @@ -322,6 +322,9 @@ namespace datatype { } } + // Check if the datatype has already been registered with a different number of parameters. + // Note: num_parameters includes the datatype name as the first parameter, so we subtract 1 + // to compare with the def's parameter count which doesn't include the name. def* d = nullptr; if (m_defs.find(name.get_symbol(), d) && d->params().size() != num_parameters - 1) { throw default_exception("datatype has already been registered but with a different number of parameters");