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

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

[Octave-bug-tracker] [bug #63841] nargout is always 0 or 1 for subsref()


From: Fernando
Subject: [Octave-bug-tracker] [bug #63841] nargout is always 0 or 1 for subsref() in classdef methods
Date: Thu, 6 Apr 2023 05:33:02 -0400 (EDT)

Follow-up Comment #21, bug #63841 (project octave):

Here is a patch that fixes both the problem from the original post and the
problem from comment #11. It passes all the tests (at least, those not
skipped), including those provided by @arb.

The idea of this patch is to differentiate the case when the number of output
arguments resulting from evaluating an expression is unkown a priori (and the
expression is not a complete statement). In this case, we call the
corresponding evaluate method with the argument nargout=-1.

I think it would be good to also add a test for these cases


>> A=tst_nargout;
>> if A(1:5).a_property,true,end
nargout=1, s(1).type = ()
ans =
  logical
   1
>> for x=A(1:5).a_property,true,end
nargout=1, s(1).type = ()
ans =
  logical
   1


It is different form the case


if cm('first').a_property, true, end


because A(1:5).a_property actually returns several outputs, of which only the
first one should be taken, while cm('first').a_property returns only one
output.

(file #54566)

    _______________________________________________________

Additional Item Attachment:

File name: bug-63481-fix2.diff            Size:4 KB
    <https://file.savannah.gnu.org/file/bug-63481-fix2.diff?file_id=54566>



    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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