Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static extensions shadow abstract's own variables #6036

Closed
MrCoft opened this issue Feb 16, 2017 · 1 comment
Closed

Static extensions shadow abstract's own variables #6036

MrCoft opened this issue Feb 16, 2017 · 1 comment

Comments

@MrCoft
Copy link

MrCoft commented Feb 16, 2017

Code example:

using Lambda;
class Test {
    static function main() {}
}
class TYPE {
    public function new() {}
    public function iterator():Iterator<Int> return new IntIterator(0, 1);
}
abstract ABSTRACT(TYPE) {
    public var array(get, never):Bool;
    function get_array() return true;
    
    public function new() {
        this = new TYPE();
        $type(array);
        $type(this.array);
    }
}

Output:

Test.hx:15: characters 14-19 : Warning : Void -> Array<Int>
Test.hx:16: characters 14-24 : Warning : Void -> Array<Int>

It is the Lambda.array(it:Iterable):Array function.
As a result, the abstract can't access its own variable in its definition.

I'd have to downgrade to confirm this but I think I started getting these bugs of getters not working with the 3.4 version.

@Simn Simn modified the milestone: 4.0 Mar 20, 2017
@Simn Simn modified the milestones: Release 4.0, Bugs Apr 17, 2018
@Simn Simn closed this as completed in 456bfb9 Jun 6, 2018
@Simn
Copy link
Member

Simn commented Jun 6, 2018

Please note that this.array still resolves to Lamda.array because this resolves to TYPE, not ABSTRACT.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants