away3d / away3d-core-openfl

Away3D engine for OpenFL
166 stars 41 forks source link

away3d.utils.ArrayUtils does not compile in Haxe 3.2 #42

Closed Type1J closed 9 years ago

Type1J commented 9 years ago

When compiling just about anything that uses Away3D with Haxe 3.2, I get: away3d/utils/ArrayUtils.hx:76: characters 15-89 : Class not found : A

I think it's related to the breaking change:

(See https://github.com/HaxeFoundation/haxe/wiki/Breaking-changes-in-Haxe-3.2.0)

Type1J commented 9 years ago

Although it's not type safe, there's another version of this code that's used for Flash, However, because the abstract type is still compiled for Flash the Flash builds will not compile.

If I comment out the abstract type used to take either Array or haxe.ds.Vector, and I used the #if flash version of the code that used Dynamic for both Flash and other platforms, then everything works correctly. Again, this version is less type safe.

Simn commented 9 years ago

This should work if you declare the cast functions like so:

    @:from static function fromA<A,B>( v:A ):AcceptEither<A,B> return new AcceptEither( Left(v) );
    @:from static function fromB<A,B>( v:B ):AcceptEither<A,B> return new AcceptEither( Right(v) );
Type1J commented 9 years ago

@Simn: Thanks, for the second time today! @Greg209: I've tested the change that @Simn suggested, and it's working great. Please add "<A,B>" between the function names and the argument list for these 2 functions.

Greg209 commented 9 years ago

@Simn & @Type1J Thanks to looking into this and getting the solution together. Your help is much appreciated :)

Simn commented 9 years ago

You're welcome! I would appreciate if you could make sure that all your tests/examples are working properly with Haxe 3.2.0-RC2.

Greg209 commented 9 years ago

Will do. Just not had chance to update to 3.2 yet but I do consider it a priority.