fponticelli / thx.core

Super-charged standard library for Haxe.
http://thx-lib.org
MIT License
124 stars 43 forks source link

error: cannot convert 'cpp::VirtualArray' to 'bool' in return #248

Closed ashes999 closed 7 years ago

ashes999 commented 7 years ago

Hi,

I'm trying to build an OpenFL app that runs on Android. I use thx.core (0.42.1) and thx.http (from GitHub), along with thx.promise (0.6.0) and thx.stream (0.6.1).

Today, I did a fresh run of lime setup android, installed the SDK/NDK/JDK/etc.

Then, when I run lime build android, I get this error:

Error: ./src/thx/Iterables.cpp: In member function 'bool thx::Iterables_obj::unionBy(Dynamic, Dynamic, Dynamic)::_hx_Closure_0::_hx_run(Dynamic)':
./src/thx/Iterables.cpp:505: error: cannot convert 'cpp::VirtualArray' to 'bool'
 in return
./src/thx/Iterables.cpp: In member function 'bool thx::Iterables_obj::differenceBy(Dynamic, Dynamic, Dynamic)::_hx_Closure_0::_hx_run(Dynamic)':
./src/thx/Iterables.cpp:530: error: cannot convert 'cpp::VirtualArray' to 'bool'
 in return

Any idea how I can resolve this, or if it is (or isn't) an issue with thx itself?

ghost commented 7 years ago

Ditto. I have the exact same problem. (Linux, hxcpp version 3.4.64, haxe version 3.4.2)

I encountered this issue while compiling thx.core for Linux. The two functions in question seem to be implemented in a clean and obvious way, nothing too tricky there.

Is this an hxcpp bug?

ashes999 commented 7 years ago

@asciiascetic thanks for verifying. I'm glad it's not my C++ environment setup. (I still haven't set that up properly ...)

ghost commented 7 years ago

@ashes999 Hey feel free to clone my fork and use the issue-248-cpp-type-conversion-error branch. I've put in a pull request for it, but until the issue resolves itself you can use the branch with haxelib dev.

git clone https://github.com/asciiascetic/thx.core
cd thx.core
git checkout issue-248-cpp-type-conversion-error

and then in haxelib, if the thx.core directory is at ~/mystuff/thx.core, do

haxelib dev thx.core ~/mystuff/thx.core

That's what I've been doing for a while. The changes in the above-mentioned branch are minor, and exist only to give the compiler hints about how to infer types in the generated c++.

ashes999 commented 7 years ago

@asciiascetic thanks for providing this. Unfortunately, I only waited a couple of days, and then moved away from using thx.

That requires some context: I'm working on a RESTful API, and I need to be able to make PUT calls from the client (JS, Neko, and Android). thx.core allowed me to do that. Core Haxe only supports GET and POST calls across JS/Android/Neko.

When I ran into this issue, I actually rewrote my PUT call to handle both the POST and PUT workflows. I'm okay with waiting for your PR to be merged in.

Thanks for mentioning; I thought my PR was falling on somewhat deaf ears :)

ashes999 commented 7 years ago

Thanks for merging. I'll undo my API changes and re-test, but I'm sure this is fixed now (as @asciiascetic saw the exact same issue).