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

Fix lime.text.Font don't know how to cast array to hl.types.ArrayBytes_Int with analyzer-optimize #1742

Merged
merged 2 commits into from
Jan 22, 2024

Conversation

T1mL3arn
Copy link
Contributor

When compiling my flixel project to hashlink with -release and analyzer-optimize I get this error:

C:/HaxeToolkit/haxe/lib/lime/8,1,1/src/lime/text/Font.hx:192: characters 10-16 : Don't know how to cast array to hl.types.ArrayBytes_Int

Tried to make a minimal repro, but didn't succeed.

Problem can be bypassed in two ways

  1. --macro haxe.macro.Compiler.addMetadata('@:analyzer(no_optimize)', 'lime.text.Font')
  2. explicitly cast value (return cast glyphs) for problem line of code:

    lime/src/lime/text/Font.hx

    Lines 188 to 196 in e6205bf

    public function getGlyphs(characters:String = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^`'\"/\\&*()[]{}<>|:;_-+=?,. "):Array<Glyph>
    {
    #if (lime_cffi && !macro)
    var glyphs:Dynamic = NativeCFFI.lime_font_get_glyph_indices(src, characters);
    return glyphs;
    #else
    return null;
    #end
    }

T1mL3arn and others added 2 commits January 10, 2024 19:45
This can happen when compiling HL with `analyzer-optimize`.
@joshtynjala joshtynjala merged commit f2ef5d0 into openfl:develop Jan 22, 2024
12 checks passed
@T1mL3arn T1mL3arn deleted the patch-2 branch January 23, 2024 00:31
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

Successfully merging this pull request may close these issues.

2 participants