diff --git a/src/stats.c b/src/stats.c index 1d1ec889c55..c7545880368 100644 --- a/src/stats.c +++ b/src/stats.c @@ -2241,9 +2241,16 @@ void PrintAssert3Args ( void PrintReturnObj ( Stat stat ) { - Pr( "%2>return%< %>", 0L, 0L ); - PrintExpr( ADDR_STAT(stat)[0] ); - Pr( "%2<;", 0L, 0L ); + Expr expr = ADDR_STAT(stat)[0]; + if ( TNUM_EXPR(expr) == T_REF_GVAR && + (UInt)(ADDR_STAT(expr)[0]) == GVarName( "TRY_NEXT_METHOD" ) ) { + Pr( "TryNextMethod();", 0L, 0L ); + } + else { + Pr( "%2>return%< %>", 0L, 0L ); + PrintExpr( expr ); + Pr( "%2<;", 0L, 0L ); + } } diff --git a/tst/testinstall/function.tst b/tst/testinstall/function.tst index ac7920fef57..1cb6d36e4bf 100644 --- a/tst/testinstall/function.tst +++ b/tst/testinstall/function.tst @@ -176,4 +176,12 @@ gap> Display(x->x); function ( x ) return x; end + +# +gap> Display(function() TryNextMethod(); end); +function ( ) + TryNextMethod(); +end + +# gap> STOP_TEST("function.tst", 1);