Skip to content

[js, neko, lua] Fix createEmptyInstance of String - #13164

Open
tobil4sk wants to merge 2 commits into
HaxeFoundation:developmentfrom
tobil4sk:fix/Type.createEmptyInstance-String
Open

tobil4sk wants to merge 2 commits into
HaxeFoundation:developmentfrom
tobil4sk:fix/Type.createEmptyInstance-String

Conversation

@tobil4sk

@tobil4sk tobil4sk commented Nov 8, 2026 •

Copy link
Copy Markdown
Member

This already works on most targets. For example, php already has special handling for this case:

haxe/std/php/_std/Type.hx

Lines 136 to 137 in e592de2

if (String == cast cl)
return cast '';

Without this, there are failures like:

unit.teststd.TestType
  test: ERROR ............................E
    bin/unit.lua:108302: attempt to concatenate a table value
unit.teststd.TestType
  test: ERROR ............................E
    std@string_split
Called from String::split line 107
Called from StringTools::replace line 405
Called from unit.Test::eq line 19
Called from unit.teststd.TestType::test line 71
Called from unit.teststd.TestType::__initializeUtest__ line 4
unit.teststd.TestType
  test: ERROR ............................E
    String.prototype.valueOf requires that 'this' be a String
Called from module TypeError: String.prototype.valueOf requires that 'this' be a String
Called from module at String.valueOf (<anonymous>)
Called from utest_Assert.equals (/.../haxe/tests/unit/bin/unit.js line 76090 column 22)
Called from unit_teststd_TestType.eq (/.../haxe/haxe/tests/unit/bin/unit.js line 11790 column 16)
Called from unit_teststd_TestType.test (/.../haxe/tests/unit/bin/unit.js line 72248 column 8)
Called from Object.execute (/.../haxe/tests/unit/bin/unit.js line 72354 column 11)
Called from utest_TestHandler.runTest (/.../haxe/tests/unit/bin/unit.js line 77149 column 31)
Called from utest_TestHandler.checkSetup (/.../haxe/tests/unit/bin/unit.js line 77144 column 9)
Called from utest_Async.then (/.../haxe/tests/unit/bin/unit.js line 76677 column 4)
Called from utest_TestHandler.runSetup (/.../haxe/tests/unit/bin/unit.js line 77137 column 19)
Called from utest_TestHandler.execute (/.../haxe/tests/unit/bin/unit.js line 77116 column 8)

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.

1 participant