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

[MotionTwin] Weird null() code generation... #50

Closed
kiroukou opened this issue Apr 8, 2014 · 2 comments
Closed

[MotionTwin] Weird null() code generation... #50

kiroukou opened this issue Apr 8, 2014 · 2 comments

Comments

@kiroukou
Copy link

kiroukou commented Apr 8, 2014

package;
class Main
{
static function main() { new Main(); }

function new() {
    var v = Main.frand();
}

inline public static function frand(?rnd:Void->Float):Float
{
    return
        if ( rnd == null )
            Math.random();
        else
            rnd();
}

}

Error:
Error: ./src/Main.cpp:24:7: error: type 'null' does not provide a call operator
v = null()().Cast< Float >();
^~~~~~
./src/Main.cpp:24:22: error: unexpected type name 'Float': expected expression
v = null()().Cast< Float >();
^
./src/Main.cpp:24:30: error: expected expression
v = null()().Cast< Float >();

@kiroukou
Copy link
Author

kiroukou commented Apr 8, 2014

That issue only exists if compiler flag --no-opt is set !!

@Simn
Copy link
Member

Simn commented Apr 8, 2014

This is a core Haxe inlining issue, see HaxeFoundation/haxe#2864

@Simn Simn closed this as completed Apr 8, 2014
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

No branches or pull requests

2 participants