bugGNU Octave - Bugs: bug #52075, Classdef local functions with same...

 
 

bug #52075: Classdef local functions with same name as methods cause parse error

Submitter:  Piotr Held <jsoh425>
Submitted:  Wed 20 Sep 2017 05:55:22 PM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  None
Originator Name:  Piotr Held Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 21 Sep 2017 04:11:08 PM UTC, comment #2: 

I made a couple of minor changes and pushed your changeset here:

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

Thanks for the patch and new test.

John W. Eaton <jwe>
Group administrator
Wed 20 Sep 2017 10:48:26 PM UTC, comment #1: 

I wrote a patch for this problem. It is basically one if statement that prepend the base_lexer::fcn_file_name to the local function name to make it different from the method name when calling parent_scope_info::name_ok(). As the comments to name_ok() state the names just have to be unique.

I also added a test for this bug.

(file #41852)

Piotr Held <jsoh425>
Wed 20 Sep 2017 05:55:22 PM UTC, original submission:  

When creating a class with a local function that has the same name as a classdef method the parser issues error about duplicate subfunction or nested function names. An example test class would be:


classdef local_fcn_methods < handle
  methods
    function duplicate
      printf('method\n');
    end
  end
end

function duplicate
  printf('local foo\n');
end


I also attached this class as an mfile to this bug submission.

Piotr Held <jsoh425>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #41847:  local_fcn_methods.m added by jsoh425 (162B - text/x-objcsrc)

 

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 jsoh425 (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 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-09-21 jwe StatusNone Fixed
        Open/ClosedOpen Closed
    2017-09-20 jsoh425 Attached File- Added local_method_dup_patch.diff, #41852
    2017-09-20 jsoh425 Attached File- Added local_fcn_methods.m, #41847

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code