[Issue 5010] Error messages for properties could be improved
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Nov 13 16:52:33 UTC 2024
https://issues.dlang.org/show_bug.cgi?id=5010
Nick Treleaven <nick at geany.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |nick at geany.org
--- Comment #4 from Nick Treleaven <nick at geany.org> ---
(In reply to Era Scarecrow from comment #2)
> > struct A
> > {
> > @property void foo(uint x);
> > }
> >
> > void main()
> > {
> > A a;
> > a.foo = "bar"; // (1)
> > }
> >
> >
> > (1) causes "Error: not a property a.foo", which may look obvious here, but gets
> > confusing with more complex types.
This is now:
propassign.d(14): Error: function `propassign.A.foo(uint x)` is not callable
using argument types `(string)`
propassign.d(14): cannot pass argument `"bar"` of type `string` to
parameter `uint x`
> Also related (similar types) it should mention those that need
> down-casting, or something more useful.
>
> struct S {
> //setters
> void test(uint v) @property {}
> void test2(ulong v) @property {}
> }
>
> ulong x;
> S s;
>
> s.test2 = x;
> s.test = x; //Error: not a property s.test
This is now:
propassign.d(28): Error: function `propassign.S.test(uint v)` is not callable
using argument types `(ulong)`
propassign.d(28): cannot pass argument `x` of type `ulong` to parameter
`uint v`
--
More information about the Digitalmars-d-bugs
mailing list