Thread overview
[Issue 5010] Error messages for properties could be improved
Aug 14, 2017
Mike
Dec 17, 2022
Iain Buclaw
August 14, 2017
https://issues.dlang.org/show_bug.cgi?id=5010

Mike <slavo5150@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |eli@sternheim.com

--- Comment #3 from Mike <slavo5150@yahoo.com> ---
*** Issue 15158 has been marked as a duplicate of this issue. ***

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=5010

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P2                          |P3

--
November 13
https://issues.dlang.org/show_bug.cgi?id=5010

Nick Treleaven <nick@geany.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nick@geany.org

--- Comment #4 from Nick Treleaven <nick@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`

--