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

[php7] Using enum constructors as closures #6177

Closed
benmerckx opened this Issue Apr 12, 2017 · 0 comments

Comments

Projects
None yet
2 participants
@benmerckx
Contributor

benmerckx commented Apr 12, 2017

When using an enum constructor as a closure things go wrong:

enum TestEnum {
    A(a: String);
}

class Main {
    static function main() {
        var list: List<String> = new List();
        list.push('a');
        list.push('b');
        trace(list.map(A));
    }
}

Gets compiled to:

class Main {
	static public function main () {
		$list = new \List_hx();
		$list->push("a");
		$list->push("b");
		(Log::$trace)($list->map(\TestEnum::A), new HxAnon([
			"fileName" => "Main.hx",
			"lineNumber" => 10,
			"className" => "Main",
			"methodName" => "main",
		]));
	}
}

Which results in:

Fatal error:  Uncaught Error: Undefined class constant 'A'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment