Bug 11078 – Diagnostic for wrong RHS in property assign of a property group should improve

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-09-20T13:56:00Z
Last change time
2014-01-15T09:44:40Z
Keywords
diagnostic, pull
Assigned to
nobody
Creator
andrej.mitrovich

Comments

Comment #0 by andrej.mitrovich — 2013-09-20T13:56:05Z
----- struct S1 { @property int value() { return 1; } @property void value(int n) { } } void main() { S1 s1; s1.value = 1.0; } ----- $ dmd test.d > test.d(12): Error: s1.value is not an lvalue It 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.
Comment #1 by andrej.mitrovich — 2013-09-20T13:57:14Z
(In reply to comment #0) > $ dmd test.d > > test.d(12): Error: s1.value is not an lvalue To see the expected diagnostic, just comment out the getter and you'll get: > test.d(12): Error: function test.S1.value (int n) is not callable > using argument types (double) Much better.
Comment #2 by dlang-bugzilla — 2013-12-17T08:56:30Z
This is a regression in 2.058. DMD 2.057 produces the expected error message.
Comment #3 by k.hara.pg — 2013-12-23T00:05:53Z
Comment #4 by github-bugzilla — 2013-12-23T15:11:05Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/c751b9ad6be2a23751b889b93f8a2ab40fcfbbb9 fix Issue 11078 - Diagnostic for wrong RHS in property assign of a property group should improve https://github.com/D-Programming-Language/dmd/commit/c9366dd6fdc8cfe2a33909aa4ea3612431d1068d Merge pull request #3014 from 9rnsr/fix11078 [REG2.058] Issue 11078 - Diagnostic for wrong RHS in property assign of a property group should improve
Comment #5 by github-bugzilla — 2013-12-31T04:13:32Z
Commit pushed to 2.065 at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/c574f04ca52096bc6d89ce7986d4386165eaad9f Merge pull request #3014 from 9rnsr/fix11078 [REG2.058] Issue 11078 - Diagnostic for wrong RHS in property assign of a property group should improve
Comment #6 by github-bugzilla — 2014-01-15T09:44:40Z