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

 
 

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

Submitter:  None
Submitted:  Thu 10 Jun 2021 07:51:45 AM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error or Warning
Status:  Fixed Assigned to:  None
Originator Name:  Odd Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * dev
Operating System:  * GNU/Linux Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 30 Aug 2021 08:47:15 AM UTC, comment #4: 

Sorry forgot to mention, @jwe thanks for the quick fix.

I verified the failing example of the OP is now working properly in Octave 7.

Closing report.

Kai Torben Ohlhus <siko1056>
Group Member
Mon 30 Aug 2021 08:43:37 AM UTC, comment #3: 

No further comments, closing report.

Kai Torben Ohlhus <siko1056>
Group Member
Fri 20 Aug 2021 06:43:41 PM UTC, comment #2: 

Can this report be closed now?

John W. Eaton <jwe>
Group administrator
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>
Group 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 siko1056 (Posted a comment)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-08-30 siko1056 StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2021-08-20 jwe CategoryNone Interpreter
    2021-06-15 jwe StatusNone Ready For Test
        Release6.2.0 dev

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code