larsiusprime / polymod

Atomic modding framework for Haxe
MIT License
162 stars 62 forks source link

[BUG] HScript can't wrap classes which use recursive type parameters. #117

Closed AltronMaxX closed 2 years ago

AltronMaxX commented 2 years ago

Hscript classes won't build classes which extended from FlxUIState.

Error from console

source/ScriptedStage.hx:7: character 1 : HScriptable: Class ScriptedStage ready to process... source/ScriptedStage.hx:7: character 1 : Building scripted class utils source/ScriptedStage.hx:7: character 1 : Processing overrides for class: ScriptedStage<{}> source/ScriptedStage.hx:7: character 1 : Processing overrides for class: FlxUIState<{}> source/ScriptedStage.hx:7: character 1 : Expected a function and got TConst(TNull) source/ScriptedStage.hx:7: character 1 : Build failure

ScriptedStage code

package; import polymod.hscript.HScriptable; @:hscriptClass class ScriptedStage extends Stage implements HScriptable {}

Class Stage extends class which extends FlxUIState

EliteMasterEric commented 2 years ago

This is a known issue that will take some effort to fix. The underlying problem is with how the HScript macro handles classes which utilize type parameters. There is basic code for type parameters in place but there are edge cases which cause compilation to fail.

This issue currently affects any class which extends FlxState, along with several others.

In the example project where HScript is implemented, ScriptedStage extends Stage. Stage is an openfl.Sprite, which does not have this type parameter issue.

AltronMaxX commented 2 years ago

Yes, I noticed such a property of the example, but I was upset when I found out that this function is incompatible with classes of this type. Thanks for fast answer <3

EliteMasterEric commented 2 years ago

Reopening because this is a bug, not a limitation. I plan to fix it eventually hopefully.

EliteMasterEric commented 2 years ago

This is now officially fixed in version 1.5.4.