[Issue 17474] non-property being treated as a property
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Wed Jun 7 00:44:20 PDT 2017
https://issues.dlang.org/show_bug.cgi?id=17474
Tomer Filiba (weka) <tomer at weka.io> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |industry
CC| |tomer at weka.io
--- Comment #1 from Tomer Filiba (weka) <tomer at weka.io> ---
I would like to elaborate a little. The existence/absence of a @property
doesn't matter here.
The thing is, the compiler first tries to lower `foo = bar` to `foo(bar)`. If
it doesn't work, it will try `foo() = bar` which is what we expect. However, in
the case of `foo = null`, the lowering to `foo(null)` does match because you
can pass `null` for a string. So, depending on the *value* I'm assigning, it
will choose different code paths, even though I'm expecting only the second
behavior.
This bug was caught in a UT, but figuring it out required I look at the
generated assembly because it was impossible to understand otherwise.
I don't know what's the "right semantics" here. It's basically the interaction
of several different features that cause this, but I definitely know it's not
what I expect from looking at the code.
--
More information about the Digitalmars-d-bugs
mailing list