Skip to content

Commit

Permalink
Show a warning when GroupWithGenerators called on a group
Browse files Browse the repository at this point in the history
In GAP <= 4.9, the following undocumented use of GroupWithGenerators
was possible:

    gap> GroupWithGenerators( Group( (1,2) ) );
    Group([ (), (1,2) ])

This does not work in GAP 4.10.0, and #3095 restored this never documented
behavior to avoid regressions in code that used to work previously.

This commit adds a warning when such use of `GroupWithGenerators` is detected.
  • Loading branch information
Alexander Konovalov authored and alex-konovalov committed May 28, 2019
1 parent 4437e09 commit d766e42
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/grp.gi
Original file line number Diff line number Diff line change
Expand Up @@ -4450,6 +4450,13 @@ InstallMethod( GroupWithGenerators,
function( gens )
local G,typ;

if IsGroup(gens) then
Info( InfoPerformance, 1,
"Calling `GroupWithGenerators' on a group usually is very inefficient.");
Info( InfoPerformance, 1,
"Use the list of generators of the group instead.");
fi;

gens:=AsList(gens);
typ:=MakeGroupyType(FamilyObj(gens),
IsGroup and IsAttributeStoringRep
Expand All @@ -4468,6 +4475,13 @@ InstallMethod( GroupWithGenerators,
function( gens, id )
local G,typ;

if IsGroup(gens) then
Info( InfoPerformance, 1,
"Calling `GroupWithGenerators' on a group usually is very inefficient.");
Info( InfoPerformance, 1,
"Use the list of generators of the group instead.");
fi;

gens:=AsList(gens);
typ:=MakeGroupyType(FamilyObj(gens),
IsGroup and IsAttributeStoringRep
Expand Down

0 comments on commit d766e42

Please sign in to comment.