Packages name conflicting with getters and setters?

Posted by MrKishi on Stack Overflow See other posts from Stack Overflow or by MrKishi
Published on 2010-06-13T19:53:16Z Indexed on 2010/06/13 21:12 UTC
Read the original article Hit count: 213

Filed under:
|
|

Hello, folks. So, I've came across this compilation error a while ago.. As there's an easy fix and I didn't find anything relevant at the time, I eventually let it go.

I just remembered it and I'm now wondering if this is really part of the language grammar (which I highly doubt) or if it's a compiler bug. I'm being purely curious about this -- it doesn't really affect development, but it would be nice to see if any of you have seen this already.

package view {
    import flash.display.Sprite;

    public class Main extends Sprite {
        private var _view:Sprite = new Sprite();

        public function Main() {
            this.test();
        }

        private function test():void {
            trace(this.view.x, this.view.y);
            //1178: Attempted access of inaccessible property x through a reference with static type view:Main.
            //1178: Attempted access of inaccessible property y through a reference with static type view:Main.
            //Note that I got this due to the package name.
            //It runs just fine if I rename the package or getter.
        }

        public function get view():Sprite {
            return this._view;
        }
    }
}

© Stack Overflow or respective owner

Related posts about actionscript-3

Related posts about compiler