-
Notifications
You must be signed in to change notification settings - Fork 175
Description
Observed behaviour
I get this in the GAP master branch; note that there are least two bugs here (possibly related): First off, it should just print something sensibly. Secondly, it should not show ErrorInner in the backtrace
gap> f:=Setter(IsPGroup and IsNilpotentGroup);;
gap> f;
Error, no method found! For debugging hints type ?Recovery from NoMethodFound
Error, no 1st choice method found for `<' on 2 arguments at /Users/mhorn/Projekte/GAP/gap.github/lib/methsel2.g:250 called from
FLAG1_FILTER( oper ) > 0 at /Users/mhorn/Projekte/GAP/gap.github/lib/type.gi:197 called from
TypeOfOperation( op ) at /Users/mhorn/Projekte/GAP/gap.github/lib/function.gi:85 called from
VIEW_STRING_OPERATION( op ) at /Users/mhorn/Projekte/GAP/gap.github/lib/function.gi:91 called from
SetUserHasQuit( 1 ); at /Users/mhorn/Projekte/GAP/gap.github/lib/error.g:253 called from
ErrorInner( rec(
context := ParentLVars( GetCurrentLVars( ) ),
mayReturnVoid := true,
lateMessage := true,
printThisStatement := false ), arg ); at /Users/mhorn/Projekte/GAP/gap.github/lib/error.g:272 called from
... at *stdin*:10
you can 'quit;' to quit to outer loop, or
you can 'return;' to continue
brk>
The problem is old, e.g. here is what I get in GAP 4.6.5 (note that the backtrace has been improved since then quite a bit):
gap> Setter(IsPGroup and IsNilpotentGroup);
Error, <flags> must be a flags list (not a boolean) in
flags := TRUES_FLAGS( FLAGS_FILTER( op ) ); called from
SHELL( GetBottomLVars( ), false, false, 3, true, prompt, function ( )
if IsBound( OnGAPPromptHook) and IsFunction( OnGAPPromptHook ) then
OnGAPPromptHook( );
else
return;
fi;
return;
end, "*stdin*", "*stdout*", true ); called from
<function "SESSION">( <arguments> )
called from read-eval loop at line 1 of *stdin*
you can replace <flags> via 'return <flags>;'
brk>
Expected behaviour
Here is how we print setters of properties, and-filter, and and-filter tester:
gap> Setter(IsPGroup);
<Setter "SetIsPGroup">
gap> IsPGroup and IsNilpotentGroup;
<Property "(IsPGroup and IsNilpotentGroup)">
gap> Tester(IsPGroup and IsNilpotentGroup);
<Filter "(HasIsPGroup and HasIsNilpotentGroup)">
I am not quite sure what to expect... Perhaps something like this, but setters are not filters, so the "and" doesn't quite make sense:
gap> Setter(IsPGroup and IsNilpotentGroup);
<Setter "(SetIsPGroup and SetIsNilpotentGroup)">
More logical would be perhaps this, but it'd also deviate from what we do for elementary filters:
gap> Setter(IsPGroup and IsNilpotentGroup);
<Setter for "(IsPGroup and IsNilpotentGroup)">
As to the immediate case: This change makes it a bit better, but it needs more work to be turned into a full fix:
diff --git a/lib/type.gi b/lib/type.gi
index 1f5ee538c..e3070e16d 100644
--- a/lib/type.gi
+++ b/lib/type.gi
@@ -194,6 +194,8 @@ function(oper)
type := "Representation";
fi;
fi;
+ elif IsOperation(FLAG1_FILTER(oper)) and IsOperation(FLAG1_FILTER(oper)) then
+ type := "Setter of and-filter";
elif FLAG1_FILTER(oper) > 0 then
type := "Setter";
elif Tester(oper) <> false thenWith that, I get:
gap> Setter(IsPGroup and IsNilpotentGroup);
<Setter of and-filter "<<setter-and-filter>>">
This is because NAME_FUNC for the and-filter returns the string <<setter-and-filter>>. I guess one could try to set it to something more sensible, like we do for properties and property testers. Or modify the print method for these to print something slightly different.