Skip to content

Custom classes fail on abstracts with implicit cast to interface #19

@Geokureli

Description

@Geokureli

Copied from: HaxeFlixel/flixel#3609

haxe 4.3 introduced stricter validation for abstract from/to declarations, requiring us to do this change, the implicit to flixel.util.FlxPool.IFlxPooled on FlxUVRect fails this check since FlxRect's underlying type isn't directly IFlxPooled.

 ERROR  C:/Users/Homura/GitHub/FNF-Shadow-Engine/.haxelib/flixel/git/flixel/graphics/frames/FlxFrame.hx:764: characters 45-75

 764 | abstract FlxUVRect(FlxRect) from FlxRect to flixel.util.FlxPool.IFlxPooled
     |                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     | You can only declare from/to with compatible types

it can be reproduced with hscript-improved's custom classes support; include this haxelib, enable CUSTOM_CLASSES (or ALLOWED_ABSTRACT_AND_ENUM ?) and include flixel in hscript-improved's Config.hx file and this exact issue starts to come.

The linked PR changes flixel's FlxRect to have @:to method for IFlxPooled. This seems like a work-around for an issue on your end, though I'm not sure how to determine this. Do you have any insight into what is causing this issue? We will be merging the work-around but I wanted to post this here as OP does not have this privilege.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions