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

Incorrect call to toString in print(Class<T>) #5155

Closed
ibilon opened this issue Apr 23, 2016 · 0 comments
Closed

Incorrect call to toString in print(Class<T>) #5155

ibilon opened this issue Apr 23, 2016 · 0 comments
Labels
platform-macro Everything related to Haxe macros platform-neko Everything related to Neko
Milestone

Comments

@ibilon
Copy link
Member

ibilon commented Apr 23, 2016

This code fails on neko, interp and run on haxe 3.2.1 and latest dev:

class T {
    public function new () { }

    public function toString () {
        var full = Type.getClassName(Type.getClass(this));
        var short = full.split (".").pop ();
        return "[object " + short + "]";
    }

    public static function main () {
        trace(Type.getClass(new T()));
    }
}

the trace seems to call the toString method, and in it Type.getClass(this) return null.

Tested and works on python, java, c#, c++ and lua.

@Simn Simn added this to the 3.4 milestone Apr 24, 2016
@Simn Simn added platform-neko Everything related to Neko platform-macro Everything related to Haxe macros labels Apr 24, 2016
@Simn Simn modified the milestones: 3.4, 4.0 Jan 9, 2017
Simn added a commit to Simn/haxe that referenced this issue May 9, 2017
@Simn Simn closed this as completed in 614b588 Jun 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform-macro Everything related to Haxe macros platform-neko Everything related to Neko
Projects
None yet
Development

No branches or pull requests

2 participants