changeset 31174:fb1c7c8a030b stable

Fix duplicate names displayed with mixed @class/classdef classes (Bug #62802) * ov-classdef.cc (F__methods__): If class is a classdef one then use get_method_map() to find methods. Otherwise, class is a legacy @class one and use load_path.methods() to get methods.
author Rik <rik@octave.org>
date Wed, 03 Aug 2022 15:25:27 -0700
parents e8a46f801825
children 2b8e8637a64e 51311efef5dd
files libinterp/octave-value/ov-classdef.cc
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/octave-value/ov-classdef.cc	Wed Aug 03 19:00:08 2022 +0200
+++ b/libinterp/octave-value/ov-classdef.cc	Wed Aug 03 15:25:27 2022 -0700
@@ -747,6 +747,7 @@
 
   if (cls.ok ())
     {
+      // Find methods for classdef objects.
       std::map<std::string, cdef_method> method_map
         = cls.get_method_map (false, true);
 
@@ -761,12 +762,13 @@
 
       sv = string_vector (method_names);
     }
-
-  // The following will also find methods for legacy @CLASS objects.
+  else
+    {
+      // Find methods for legacy @CLASS objects.
+      load_path& lp = interp.get_load_path ();
 
-  load_path& lp = interp.get_load_path ();
-
-  sv.append (lp.methods (class_name));
+      sv = string_vector (lp.methods (class_name));
+    }
 
   return ovl (Cell (sv));
 }