www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8549] New: Bad error message with const methods

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8549

           Summary: Bad error message with const methods
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc



This needs a much better error message:


struct Foo {
    int[] opSlice() {
        return [0];
    }
}
struct Bar {
    Foo spam;
    const(Foo) bar() const { return spam; }
}
void main() {
    Bar().bar()[];
}



DMD 2.061alpha gives:

test.d(11): Error: function test.Foo.opSlice () is not callable using argument
types ()

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 15 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8549


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |andrej.mitrovich gmail.com
         Resolution|                            |DUPLICATE



20:57:41 PDT ---
Issue6707 covers this, the error message is now:

test.d(11): Error: function test.Foo.opSlice () is not callable using argument
types () const

*** This issue has been marked as a duplicate of issue 6707 ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 19 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8549





 Issue6707 covers this, the error message is now:
I agree with closing this as dupe. But I think adding "const" at the end is not nearly enough to make the error message clear. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 19 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8549




21:40:56 PDT ---


 Issue6707 covers this, the error message is now:
I agree with closing this as dupe. But I think adding "const" at the end is not nearly enough to make the error message clear.
I would take a bigger pull to fix this since there's a lot of code duplication in DMD. Personally I would change the message to: Error: function test.Foo.opSlice () is not callable using const(this) What do you think? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 19 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8549




21:41:21 PDT ---

 I would take
*It* would take. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 19 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8549






 I would take a bigger pull to fix this since there's a lot of code duplication
 in DMD. Personally I would change the message to:
 
 Error: function test.Foo.opSlice () is not callable using const(this)
 
 What do you think?
Do you want me to reopen this bug report? Maybe an error message that tells what to do is better (not complete error message): test.d(11): Error: function test.Foo.opSlice() needs to be const to [...] -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 20 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8549






 Do you want me to reopen this bug report?
I have reopened Issue 6707 instead. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 21 2012