bugGNU Octave - Bugs: bug #60763, use of function 'properties'...

 
 

bug #60763: use of function 'properties' within a classdef appears to confuse parser

Submitted by:  None
Submitted on:  Thu 10 Jun 2021 07:51:45 AM UTC  
 
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error or Warning
Status:  Ready For Test Assigned to:  None
Originator Name:  Odd Originator Email:  -email is unavailable-
Open/Closed:  Open Release:  dev
Operating System:  GNU/Linux

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Tue 15 Jun 2021 04:40:34 PM UTC, comment #1: 

I pushed the following changeset to fix the way we were handling "properties", "methods", "events", and "enumeration" as keywords in the parser:

http://hg.savannah.gnu.org/hgweb/octave/rev/ad1491462d13

This change was made on the default branch so will not appear in a released version of Octave until version 7.

John W. Eaton <jwe>
Project Administrator
Thu 10 Jun 2021 07:51:45 AM UTC, original submission:  

Using the function 'properties' inside a classdef results in a parse error.  The following class cannot be instanciated:

classdef PropFail
   properties
      some_prop
   end

   methods

      function props = failingMethod(instance)

         props = properties(instance);

      end

   end
end

If I try to create an instance, the following happens:

octave> obj = PropFail()
error: parse error near line 10 of file /home/oddan/gitted/source/mrst/mrst-other/ruden-geothermal/PropFail.m

  syntax error

>>>          props = properties(instance);
                              ^

If, on the other hand, the 'properties' function is moved out of the lexical scope of the classdef, it works fine:

classdef PropWorks
   properties
      some_prop
   end

   methods

      function props = failingMethod(instance)

         props = getprops(instance);

      end

   end
end

function p = getprops(instance)
  p = properties(instance);
end

I can create an instance of the latter without problem:

octave> obj = PropWorks()
obj =

  PropWorks object with properties:

      some_prop: [0x0 double]

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

     

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-06-15 jwe StatusNone => Ready For Test
        Release6.2.0 => dev

    Back to the top


    Powered by Savane 3.6