diff --git a/CAP/PackageInfo.g b/CAP/PackageInfo.g index a21cbc8936..fd09641f6e 100644 --- a/CAP/PackageInfo.g +++ b/CAP/PackageInfo.g @@ -10,7 +10,7 @@ SetPackageInfo( rec( PackageName := "CAP", Subtitle := "Categories, Algorithms, Programming", -Version := "2026.07-03", +Version := "2026.07-04", Date := (function ( ) if IsBound( GAPInfo.SystemEnvironment.GAP_PKG_RELEASE_DATE ) then return GAPInfo.SystemEnvironment.GAP_PKG_RELEASE_DATE; else return Concatenation( ~.Version{[ 1 .. 4 ]}, "-", ~.Version{[ 6, 7 ]}, "-01" ); fi; end)( ), License := "GPL-2.0-or-later", diff --git a/CAP/gap/CAP.gi b/CAP/gap/CAP.gi index a876089c47..98e074e666 100644 --- a/CAP/gap/CAP.gi +++ b/CAP/gap/CAP.gi @@ -333,6 +333,8 @@ InstallGlobalFunction( "CreateCapCategoryWithDataTypes", FunctionWithNamedArgume od; obj!.added_functions := rec( ); + + obj!.number_of_installed_methods := rec( ); obj!.operations := rec( ); diff --git a/CAP/gap/InstallAdds.gd b/CAP/gap/InstallAdds.gd index bb1ee3ab91..851e899b89 100644 --- a/CAP/gap/InstallAdds.gd +++ b/CAP/gap/InstallAdds.gd @@ -8,6 +8,8 @@ #! @Section InstallAdd Function +DeclareInfoClass( "CapOperationInstallationInfo" ); + DeclareOperation( "AddCapOperation", [ IsString, IsCapCategory, IsFunction, IsInt ] ); DeclareGlobalFunction( "CAP_INTERNAL_INSTALL_ADDS_FROM_RECORD" ); diff --git a/CAP/gap/InstallAdds.gi b/CAP/gap/InstallAdds.gi index 20d990d5fe..6491a690dc 100644 --- a/CAP/gap/InstallAdds.gi +++ b/CAP/gap/InstallAdds.gi @@ -23,7 +23,7 @@ InstallMethod( AddCapOperation, [ "IsPrecompiledDerivation", false ], ], function( CAP_NAMED_ARGUMENTS, function_name, category, func_to_install, weight ) - local record, category_name, is_derivation, is_final_derivation, is_precompiled_derivation, type, replaced_filter_list, + local record, category_name, is_derivation, is_final_derivation, is_precompiled_derivation, type, replaces_primitive_installation, replaced_filter_list, input_human_readable_identifier_getter, input_sanity_check_functions, data_type, output_human_readable_identifier_getter, output_data_type, output_sanity_check_function, filter_string; @@ -68,6 +68,8 @@ InstallMethod( AddCapOperation, type := "primitive_installation"; fi; + + replaces_primitive_installation := false; # Display a warning in various cases when overwriting existing functions if IsBound( category!.operations.(function_name) ) then @@ -88,6 +90,20 @@ InstallMethod( AddCapOperation, return; fi; + + replaces_primitive_installation := + category!.operations.( function_name ).type = "primitive_installation" and + type = "primitive_installation"; + + if replaces_primitive_installation then + + Info( CapOperationInstallationInfo, 1, + "Duplicate primitive installation for ", function_name, + " in category \"", category_name, + "\": replacing weight ", category!.operations.( function_name ).weight, + " with weight ", weight, "." ); + + fi; if category!.operations.( function_name ).type = "primitive_installation" then @@ -221,6 +237,20 @@ InstallMethod( AddCapOperation, fi; fi; + + if replaces_primitive_installation then + + return; + + fi; + + if not IsBound( category!.number_of_installed_methods.( function_name ) ) then + + category!.number_of_installed_methods.( function_name ) := 0; + + fi; + + category!.number_of_installed_methods.( function_name ) := category!.number_of_installed_methods.( function_name ) + 1; if not category!.overhead then @@ -229,7 +259,7 @@ InstallMethod( AddCapOperation, function( arg ) - return CallFuncList( func_to_install, arg ); + return CallFuncList( category!.operations.( function_name ).func, arg ); end ); @@ -280,7 +310,7 @@ InstallMethod( AddCapOperation, fi; - result := CallFuncList( func_to_install, arg ); + result := CallFuncList( category!.operations.( function_name ).func, arg ); if collect_timing_statistics then diff --git a/CompilerForCAP/PackageInfo.g b/CompilerForCAP/PackageInfo.g index 7900d44616..d71e81d208 100644 --- a/CompilerForCAP/PackageInfo.g +++ b/CompilerForCAP/PackageInfo.g @@ -10,7 +10,7 @@ SetPackageInfo( rec( PackageName := "CompilerForCAP", Subtitle := "Speed up and verify categorical algorithms", -Version := "2026.06-06", +Version := "2026.07-01", Date := (function ( ) if IsBound( GAPInfo.SystemEnvironment.GAP_PKG_RELEASE_DATE ) then return GAPInfo.SystemEnvironment.GAP_PKG_RELEASE_DATE; else return Concatenation( ~.Version{[ 1 .. 4 ]}, "-", ~.Version{[ 6, 7 ]}, "-01" ); fi; end)( ), License := "GPL-2.0-or-later", @@ -70,7 +70,7 @@ Dependencies := rec( GAP := ">= 4.13.0", NeededOtherPackages := [ [ "ToolsForHomalg", ">= 2026.04-01" ], - [ "CAP", ">= 2026.06-03" ], + [ "CAP", ">= 2026.07-04" ], ], SuggestedOtherPackages := [ ], ExternalConditions := [ ], diff --git a/CompilerForCAP/gap/ResolveOperations.gi b/CompilerForCAP/gap/ResolveOperations.gi index b3163d61c2..ac5bb73573 100644 --- a/CompilerForCAP/gap/ResolveOperations.gi +++ b/CompilerForCAP/gap/ResolveOperations.gi @@ -159,7 +159,7 @@ InstallGlobalFunction( CapJitResolvedOperations, function ( tree ) Info( InfoCapJit, 1, "####" ); Info( InfoCapJit, 1, Concatenation( "Resolve CAP operation ", operation_name, ", recurse compilation." ) ); - CAP_JIT_INTERNAL_WARN_ABOUT_SIMILAR_METHODS( operation, Length( info.filter_list ), [ CapJitDataTypeOfCategory( category ).filter ], Length( category!.added_functions.(operation_name) ), { operation_name } -> Concatenation( + CAP_JIT_INTERNAL_WARN_ABOUT_SIMILAR_METHODS( operation, Length( info.filter_list ), [ CapJitDataTypeOfCategory( category ).filter ], category!.number_of_installed_methods.(operation_name), { operation_name } -> Concatenation( # COVERAGE_IGNORE_BLOCK_START "WARNING: A method for the CAP operation ", operation_name, " was installed manually (e.g. using Install(Other)Method), ", "but CompilerForCAP will always resolve the methods installed via CAP's Add-functions.\n"