openfl / lime

A foundational Haxe framework for cross-platform development
https://lime.openfl.org/
MIT License
749 stars 361 forks source link

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

Closed T1mL3arn closed 6 months ago

T1mL3arn commented 6 months ago

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: https://github.com/openfl/lime/blob/e6205bf3aaace23c7e2458841da4435ff9879eaf/src/lime/text/Font.hx#L188-L196