Thread overview
Error: not a property - ?
Feb 10, 2013
Era Scarecrow
Feb 10, 2013
Jonathan M Davis
Feb 10, 2013
Era Scarecrow
Feb 10, 2013
Jonathan M Davis
Feb 10, 2013
Era Scarecrow
February 10, 2013
 This is an unexpected error; Seems it's the result of not down-casting a variable-type. Is this a bug? Or just need a better error message?

Version: DMD32 D Compiler v2.061


  struct S {
    void test(uint v) @property {}
    void test2(ulong v) @property {}
  }

  ulong x;
  S s;

  s.test2 = x;
  s.test = x;  //s.test is not a property
February 10, 2013
On Sunday, February 10, 2013 04:16:26 Era Scarecrow wrote:
>   This is an unexpected error; Seems it's the result of not
> down-casting a variable-type. Is this a bug? Or just need a
> better error message?
> 
> Version: DMD32 D Compiler v2.061
> 
> 
>    struct S {
>      void test(uint v) @property {}
>      void test2(ulong v) @property {}
>    }
> 
>    ulong x;
>    S s;
> 
>    s.test2 = x;
>    s.test = x;  //s.test is not a property

It's not a bug. The assignment is illegal, because a you can't assign a ulong to a uint without casting, but the error message obviously isn't very good. It probably gives that error whenever you try and use the property syntax, and there's no variable or function with that name that compiles with the given argument. It really should be indicating that the argument itself is invalid, but however the combination of lowering and error messages works, you end up with a less than helpful error message.

- Jonathan M Davis
February 10, 2013
On Sunday, 10 February 2013 at 03:24:37 UTC, Jonathan M Davis wrote:
> On Sunday, February 10, 2013 04:16:26 Era Scarecrow wrote:
>> This is an unexpected error; Seems it's the result of not down-casting a variable-type. Is this a bug? Or just need a better error message?
>> 
>> Version: DMD32 D Compiler v2.061
>> 
>> 
>>    struct S {
>>      void test(uint v) @property {}
>>      void test2(ulong v) @property {}
>>    }
>> 
>>    ulong x;
>>    S s;
>> 
>>    s.test2 = x;
>>    s.test = x;  //s.test is not a property
>
> It's not a bug. The assignment is illegal, because a you can't assign a ulong to a uint without casting, but the error message obviously isn't very good. It probably gives that error whenever you try and use the property syntax, and there's no variable or function with that name that compiles with the given argument. It really should be indicating that the argument itself is invalid, but however the combination of lowering and error messages works, you end up with a less than helpful error message.

 I figured as much. Very difficult to figure out the culprit when it's from bitfields mixed with perfectly normal code for assignment.

 Where should I add to the bug tracker so the error message can be improved?
February 10, 2013
On Sunday, February 10, 2013 04:38:56 Era Scarecrow wrote:
>   Where should I add to the bug tracker so the error message can
> be improved?

Just create a new bug report for it: http://d.puremagic.com/issues

- Jonathan M Davis
February 10, 2013
On Sunday, 10 February 2013 at 03:45:37 UTC, Jonathan M Davis wrote:
> On Sunday, February 10, 2013 04:38:56 Era Scarecrow wrote:
>> Where should I add to the bug tracker so the error message can be improved?
>
> Just create a new bug report for it: http://d.puremagic.com/issues
>
> - Jonathan M Davis

 Found it's bug 5010; Added comment for that specific case.

 http://d.puremagic.com/issues/show_bug.cgi?id=5010