# HG changeset patch # User John W. Eaton # Date 1607972110 18000 # Node ID eec0fe95576efd836b7ac8be3f1f7699ea73bf4e # Parent bd5961abe971b6f46f4f2bdb6aed720e7dcb79f9 avoid dispatch error if methdo argument is a function handle (bug #59617) * ov-fcn-handle.h (octave_fcn_handle::builtin_type): Define method accidentally omitted in recent function handle refactoring. * test/bug-59617/@bug59617/bug59617.m, test/bug-59617/@bug59617/max.m, test/bug-59617/bug-59617.tst, test/bug-59617/module.mk: New test files based on test provided by Markus Mützel. * test/module.mk: Update. diff -r bd5961abe971 -r eec0fe95576e libinterp/octave-value/ov-fcn-handle.h --- a/libinterp/octave-value/ov-fcn-handle.h Mon Dec 07 19:04:55 2020 +0100 +++ b/libinterp/octave-value/ov-fcn-handle.h Mon Dec 14 13:55:10 2020 -0500 @@ -241,6 +241,8 @@ bool is_defined (void) const { return true; } + builtin_type_t builtin_type (void) const { return btyp_func_handle; } + bool is_function_handle (void) const { return true; } bool is_internal (void) const { return m_rep->is_internal (); } diff -r bd5961abe971 -r eec0fe95576e test/bug-59617/@bug59617/bug59617.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/bug-59617/@bug59617/bug59617.m Mon Dec 14 13:55:10 2020 -0500 @@ -0,0 +1,5 @@ +function obj = bug59617 () + + obj = class (struct (), "bug59617"); + +endfunction diff -r bd5961abe971 -r eec0fe95576e test/bug-59617/@bug59617/max.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/bug-59617/@bug59617/max.m Mon Dec 14 13:55:10 2020 -0500 @@ -0,0 +1,9 @@ +function r = max (a, b) + if (nargin != 2) + error ("@bug59617/max: invalid number of arguments"); + endif + if (! isa (a, "bug59617") && ! isa (b, "bug59617")) + error ("@bug59617/max: expecting one argument to be a bug59617 object"); + endif + r = "@bug59617/max"; +endfunction diff -r bd5961abe971 -r eec0fe95576e test/bug-59617/bug-59617.tst --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/bug-59617/bug-59617.tst Mon Dec 14 13:55:10 2020 -0500 @@ -0,0 +1,5 @@ +%!test +%! obj = bug59617 (); +%! assert (max (@() 1, obj), "@bug59617/max") +%! assert (max (obj, @() 2), "@bug59617/max") +%! assert (max (obj, obj), "@bug59617/max") diff -r bd5961abe971 -r eec0fe95576e test/bug-59617/module.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/bug-59617/module.mk Mon Dec 14 13:55:10 2020 -0500 @@ -0,0 +1,6 @@ +bug_59617_TEST_FILES = \ + %reldir%/@bug59617/bug59617.m \ + %reldir%/@bug59617/max.m \ + %reldir%/bug-59617.tst + +TEST_FILES += $(bug_59617_TEST_FILES) diff -r bd5961abe971 -r eec0fe95576e test/module.mk --- a/test/module.mk Mon Dec 07 19:04:55 2020 +0100 +++ b/test/module.mk Mon Dec 14 13:55:10 2020 -0500 @@ -86,6 +86,7 @@ include %reldir%/bug-58572/module.mk include %reldir%/bug-58593/module.mk include %reldir%/bug-59451/module.mk +include %reldir%/bug-59617/module.mk include %reldir%/class-concat/module.mk include %reldir%/classdef/module.mk include %reldir%/classdef-multiple-inheritance/module.mk