octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #48693] classdef subsref method is not called


From: Nicholas Jankowski
Subject: [Octave-bug-tracker] [bug #48693] classdef subsref method is not called with correct nargout value
Date: Mon, 28 Nov 2022 16:17:43 -0500 (EST)

Update of bug #48693 (project octave):

                Category:             Interpreter => Classdef               
              Item Group:    Matlab Compatibility => Incorrect Result       

    _______________________________________________________

Follow-up Comment #3:

The attached patch still applies cleanly to either stable and default branches
and passes a make check on default.

with the patch applied, the following test class:

classdef foo
  methods (Access = public)
    function varargout = subsref (x, idx)
      varargout = num2cell(zeros(size(idx(1).subs{1})));
    endfunction
  endmethods
endclassdef


now results in the following output:



>> x = foo
x =

  foo object with properties:


>> x{1:10}
ans = 0
ans = 0
ans = 0
ans = 0
ans = 0
ans = 0
ans = 0
ans = 0
ans = 0
ans = 0

>> y = {x{1:10}}
y =
{
  [1,1] = 0
  [1,2] = 0
  [1,3] = 0
  [1,4] = 0
  [1,5] = 0
  [1,6] = 0
  [1,7] = 0
  [1,8] = 0
  [1,9] = 0
  [1,10] = 0
}

>> clear y

>> [y{1:10}] = x{1:10}
y =
{
  [1,1] = 0
  [1,2] = 0
  [1,3] = 0
  [1,4] = 0
  [1,5] = 0
  [1,6] = 0
  [1,7] = 0
  [1,8] = 0
  [1,9] = 0
  [1,10] = 0
}



I've refreshed the patch and cleaned up the commit message. Unless someone
sees any issue with the approach taken, i think this is ready to push to
Octave 9 unless someone thinks the bugfix is worth pushing to 8.1 before
release.

(file #54033)

    _______________________________________________________

Additional Item Attachment:

File name: classdef_subsref_nargout_bug48693_v2.patch Size:3 KB
   
<https://file.savannah.gnu.org/file/classdef_subsref_nargout_bug48693_v2.patch?file_id=54033>



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?48693>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]