[Issue 9630] DMD git: can't access array field properties from static method
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Mar 1 21:49:20 PST 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9630
--- Comment #6 from Kenji Hara <k.hara.pg at gmail.com> 2013-03-01 21:49:19 PST ---
(In reply to comment #5)
> Well, the observable effect is inconsistent and makes no sense:
> someInt.max works, but someArrayOfInt[0].max doesn't.
> The tests included with the pull do not test attributes of array elements, only
> of individual fields and concatenation with arrays, so I'm quite sure it's a
> bug.
That is mostly intended. The introduced rule by pull 1687 is:
1. In expr.aStaticMember exists, if expr is just a variable that needs this, it
is specially treated as typeof(expr).someStaticMember.
This is useful for Type.field.init, Type.field.offsetof, etc.
2. In expr.aFieldVariable, if expr is just a variable that needs this, the
"need this" error for aFieldVariable access is specially delayed.
This is more specialized 'exception' than #1.
The chain of field access like following would be accepted by this.
Type.field1.field2.field3.staticFieldOrFunction
#2 is introduced by @dawgfoto's comment.
https://github.com/D-Programming-Language/dmd/pull/1687#issuecomment-14090801
In original code, index access `i[0]` does not fit to above rule. So it will
raise "need this" error normally.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list