Summary: Error messages for properties could be improved
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic
          Severity: minor
          Priority: P2
         Component: DMD

--- Comment #0 from Don <> 2010-10-07 07:22:52 PDT ---
The problem with the error messages is that they refer to the property in the
syntax it has AFTER conversion to a function call.

CASE 1: Assignments cannot be chained through properties

void prop(int x) {}

void main()
   int a = prop = 6;
bug.d(7): Error: expression prop(6) is void and has no value

The error message is quite difficult to understand. I do think it is quite
reasonable that it fails to compile, though, since the getter could be defined

int prop() { return 2; }

Secondly, the error messages when you use a getter (eg, int a = prop; ), when
only a setter is defined, are:

bug.d(7): Error: function test0.prop (int x) is not callable using argument
types ()
bug.d(8): Error: expected 1 function arguments, not 0
bug.d(9): Error: expression prop() is void and has no value

This error message is confusing because no parens were used.

The same situation applies when trying to use a setter, when only a getter is

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to