digitalmars.D.bugs - [Issue 11078] New: Diagnostic for wrong RHS in property assign of a property group should improve
- d-bugmail puremagic.com (37/38) Sep 20 2013 http://d.puremagic.com/issues/show_bug.cgi?id=11078
- d-bugmail puremagic.com (8/12) Sep 20 2013 http://d.puremagic.com/issues/show_bug.cgi?id=11078
http://d.puremagic.com/issues/show_bug.cgi?id=11078 Summary: Diagnostic for wrong RHS in property assign of a property group should improve Product: D Version: D2 Platform: All OS/Version: All Status: NEW Keywords: diagnostic Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: andrej.mitrovich gmail.com 13:56:05 PDT --- ----- struct S1 { property int value() { return 1; } property void value(int n) { } } void main() { S1 s1; s1.value = 1.0; } ----- $ dmd test.dtest.d(12): Error: s1.value is not an lvalueIt seems the compiler first attempts to call "s1.value(1.0)" (the setter), but gags the error, and then tries to call "s1.value() = 1.0" and emits a diagnostic for the getter. A more appropriate thing to do is to prefer writing a diagnostic for the setter. It is arguably more common to mistake the proper RHS type of an expression, and ref-return getter properties are quite rare. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 20 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11078 13:57:14 PDT ---$ dmd test.dTo see the expected diagnostic, just comment out the getter and you'll get:test.d(12): Error: s1.value is not an lvaluetest.d(12): Error: function test.S1.value (int n) is not callable using argument types (double)Much better. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 20 2013