www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12988] New: Diagnostic for wrong 'this' prefix when matching

https://issues.dlang.org/show_bug.cgi?id=12988

          Issue ID: 12988
           Summary: Diagnostic for wrong 'this' prefix when matching
                    parameter is found should improve
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: diagnostic
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: andrej.mitrovich gmail.com

-----
class F
{
    void test(string str)
    {
        this.str = "";
    }
}

void main()
{
}
-----

$ dmd test.d
 test.d(5): Error: no property 'str' for type 'test.F'
The compiler should try to detect whether 'str' is also a parameter name, and in this case emit something like: $ dmd test.d
 test.d(5): Error: no property 'str' for type 'test.F', did you mean parameter
'str'?
--
Jun 25 2014