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

Arrays of mixed types are only allowed if the type is forced to Array<Dynamic> #6

Open
restorer opened this issue Oct 29, 2018 · 5 comments

Comments

@restorer
Copy link

class Bug1 {
    public function bug() : Void {
        // Arrays of mixed types are only allowed if the type is forced to Array<Dynamic>
        // Bug in "safeArray"
        ["A", 1];
    }
}

See https://github.com/restorer/haxe-safety-bugs/blob/master/safetybugs/Main.hx#L43 for working example.

@restorer
Copy link
Author

This is for Haxe 4.0.0-preview.5 and Safety from master.

@RealyUniqueName
Copy link
Owner

This is not related to Safety. It's a pure Haxe behavior: http://try-haxe.mrcdk.com/#A3BF6

@restorer
Copy link
Author

Sorry, bad example. I will provide correct example later.

@RealyUniqueName
Copy link
Owner

Feel free to reopen.

@restorer
Copy link
Author

restorer commented Oct 29, 2018

Correct example:

class Bug1Corrected {
    public function foo(a : Array<Dynamic>) : Void {
        trace(a);
    }

    public function bug() : Void {
        // Arrays of mixed types are only allowed if the type is forced to Array<Dynamic>
        // Bug in "safeArray"
        foo(["A", 1]);
    }
}

Test project: https://github.com/restorer/haxe-safety-bugs/blob/master/safetybugs/Main.hx#L207

Pure Haxe: http://try-haxe.mrcdk.com/#CdD25

P.S. Also either I don't know how to reopen issues on github 😄 or I doesn't have permissions for that.

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