Thread overview
[Issue 6981] New: incorrect error message when calling method without parentheses
Nov 20, 2011
Trass3r
Nov 20, 2011
Trass3r
Dec 28, 2012
Andrej Mitrovic
November 20, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6981

           Summary: incorrect error message when calling method without
                    parentheses
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: mrmocool@gmx.de


--- Comment #0 from Trass3r <mrmocool@gmx.de> 2011-11-20 13:48:56 PST ---
class Document
{
    const
    override hash_t toHash()
    {
        return super.toHash;
    }
}

Error: function object.Object.toHash () is not callable using argument types ()

If you change it into 'return super.toHash();' then it prints
Error: function object.Object.toHash () is not callable using argument types ()
const

OT: I really wish that horrible error message would be turned into something more easily understandable like 'function can't be called on a const instance' or whatever.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 20, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6981



--- Comment #1 from Trass3r <mrmocool@gmx.de> 2011-11-20 13:57:30 PST ---
Actually I think it shouldn't even get to that point.
Shouldn't it complain about toHash not overriding a base method?

The above error message isn't helpful at all, especially if the const isn't applied to the function directly but through a 'const: /*many functions*/'.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 28, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6981


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

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


--- Comment #2 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-12-27 17:50:19 PST ---
Now it's:

Error: not a property super.toHash

After adding parens:

Error: function object.Object.toHash () is not callable using argument types ()
const

After Issue 1730 is fixed the error message will improve.

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

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------