-
-
Save ShadowBelmolve/8289232 to your computer and use it in GitHub Desktop.
haxe-traits break with this. Seems that if you import an "interface A"(IEntity) that has a variable of type "class B"(EntityData) that has a function with return type "class C"(Entity) and "class C" implements the "interface A", then variables from "interface A" simply aren't copied to "class C" or something like this. The same if you import "Cl…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package; | |
//works | |
//import world.Entity; | |
//works | |
//import world.IEntity; | |
//import world.Entity; | |
//not work | |
//import world.Entity; | |
//import world.IEntity; | |
//not work | |
import world.IEntity; | |
/** | |
* @author Joshua Granick | |
*/ | |
class Main | |
{ | |
// Entry point | |
static public function main():Void | |
{ | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
➜ haxe -main Main -lib traits | |
world/Entity.hx:3: lines 3-4 : Field entityData needed by world.IEntity is missing | |
world/Entity.hx:3: lines 3-4 : Field x needed by world.IEntity is missing | |
world/Entity.hx:3: lines 3-4 : Field y needed by world.IEntity is missing | |
world/Entity.hx:3: lines 3-4 : Field z needed by world.IEntity is missing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package world; | |
class Entity implements IEntity | |
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package world; | |
class EntityData | |
{ | |
//Entity here is important | |
public function breakAll() : Entity | |
{ | |
return null; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package world; | |
interface IEntity extends traits.ITrait | |
{ | |
public var x:Float = 0.0; | |
public var z:Float = 0.0; | |
public var y:Float = 0.0; | |
//EntityData here is important | |
public var entityData:EntityData; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment