[Issue 10418] New: bad error message: "not a property"

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jun 19 16:31:27 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10418

           Summary: bad error message: "not a property"
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: destructionator at gmail.com


--- Comment #0 from Adam D. Ruppe <destructionator at gmail.com> 2013-06-19 16:31:26 PDT ---
===
struct S {
        @property void number(int a) { }
}

void main() {
        S s;
        s.number = "10";
}
===

$ dmd test22
test22.d(7): Error: not a property s.number


As you can see, it obviously is a property, but it takes int and I gave it a
string.

A better message would be

Error: not a property s.number(int)

or better yet,

Error: cannot implicitly convert expression ("10") of type string to int

especially since there are no overloads. If there were, I think what would be
best is something like:

Error: no matching function "number" for arguments (string). Did you mean
number(int)?



Listing all possible overloads could lead to really spammy messages, but if it
ran the spell check algorithm on the type signatures and gave the closest
match(s), I think that would be manageable and generally useful, in all cases
with overloaded functions.

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


More information about the Digitalmars-d-bugs mailing list