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

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

[Octave-bug-tracker] [bug #55812] Interpreter gives incorrect line numbe


From: Rik
Subject: [Octave-bug-tracker] [bug #55812] Interpreter gives incorrect line number for class name / file name mismatch
Date: Sat, 2 Mar 2019 13:22:13 -0500 (EST)
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko

URL:
  <https://savannah.gnu.org/bugs/?55812>

                 Summary: Interpreter gives incorrect line number for class
name / file name mismatch
                 Project: GNU Octave
            Submitted by: rik5
            Submitted on: Sat 02 Mar 2019 10:22:12 AM PST
                Category: Interpreter
                Severity: 2 - Minor
                Priority: 5 - Normal
              Item Group: Inaccurate Result
                  Status: Confirmed
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: Any

    _______________________________________________________

Details:

When parsing a classdef file the name of the class must match the name of the
file exactly.  If it does not, Octave emits an error about the mismatch, but
incorrectly points to the line in the file corresponding to "endclassdef"
rather than the true source of the error which is the initial "classdef"
statement.

I found this accidentally with the following code which I placed in the
lowercase filename "mydumbclass.m"


classdef MyDumbClass

  properties
    data
  endproperties

  methods
    function this = MyDumbClass (data)
      this.data = data;
    endfunction
    
    function out = sizeof (this)
      out = sizeof (this.data);
    endfunction
  endmethods

endclassdef


When trying to create an instance of the class I received the following error


octave:1> x = mydumbclass
parse error near line 17 of file
/home/rik/wip/Projects_Mine/octave-dev/mydumbclass.m

  invalid classdef definition, the class name must match the filename

>>> endclassdef


It would be better if it cited line 1 and gave this reference


>>> classdef MyDumbClass







    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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