Skip to content

Commit 70ace94

Browse files
committed
Let Display for functions print where it was defined
... at least when that information is available
1 parent 53348b3 commit 70ace94

File tree

5 files changed

+11
-2
lines changed

5 files changed

+11
-2
lines changed

lib/function.gi

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,14 @@ end);
6262

6363
InstallMethod(Display, "for a function", [IsFunction and IsInternalRep],
6464
function(fun)
65+
local loc;
66+
loc := FilenameFunc(fun);
67+
if loc <> fail and loc <> "stream" and loc <> "*stdin*" and loc <> "*errin*" then
68+
loc := LocationFunc(fun);
69+
if loc <> fail then
70+
Print("# ", loc, "\n");
71+
fi;
72+
fi;
6573
Print(fun, "\n");
6674
end);
6775

tst/testinstall/grpreps.tst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,3 @@ gap> List( res2[2], r -> [ r.field, r.dimension ] );
1818

1919
#
2020
gap> STOP_TEST( "grpreps.tst" );
21-

tst/testinstall/opers/BindingsOfClosure.tst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ rec( NewAorP := function( name, filter, args... ) ... end,
3838
reqs := [ <Filter "(IsMagmaWithInverses and IsAssociative)">,
3939
<Category "IsListOrCollection">, <Category "IsList">,
4040
<Category "IsList">, <Category "IsFunction"> ], usetype := false )
41-
gap> Display(f);
41+
gap> Print(f, "\n");
4242
function ( G, D )
4343
if D = MovedPoints( G ) then
4444
return op( G );

tst/testinstall/varargs.tst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ Syntax error: ) expected in stream:1
7575
function(a,b....) end;
7676
^
7777
gap> Display(RETURN_FIRST);
78+
# src/gap.c:RETURN_FIRST
7879
function ( first, rest... )
7980
<<kernel code>> from src/gap.c:RETURN_FIRST
8081
end

tst/testspecial/print-compiled-func.g.out

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ function ( opr, info, rel, flags, baserank, method )
33
<<compiled GAP code>> from GAPROOT/lib/oper1.g:LINE
44
end
55
gap> Display(InstallMethod);
6+
# GAPROOT/lib/oper1.g:LINE
67
function ( arg... )
78
<<compiled GAP code>> from GAPROOT/lib/oper1.g:LINE
89
end

0 commit comments

Comments
 (0)