Skip to content

Function type as return type not supported #656

@derRaab

Description

@derRaab

Hi - first of all - thanks for this great plugin! While writing some externs I discovered that the plugin doesn't support a function type as return type. I created a valid code example on https://try.haxe.org/#e1A50 which I paste here:

class Test {
    static function main() {
        // a is fine
        var a : Any -> Any -> Any =
        function ( any : Any, any2 : Any ) : Any {
            trace( "a()" );
            return any;
        };

        // b is fine as well
        var b : (Void -> Void) -> Void =
        function ( func : Void -> Void ) : Void {
            trace( "b()" );
        };

        // c isn't:
        var c : Void -> (Void -> Void) =
        function () : Void -> Void {
            trace( "c()" );
            return function() : Void {
                trace( "d()" );
            }
        };

        a( "any", "any");
        b( function() { trace( "b(())" ); } );
        var d = c();
        d();
    }
}

And here a little shot of the error displayed in IntelliJ IDEA:

bildschirmfoto 2017-07-28 um 16 21 39

Looks not that bad in this code example, but on a different setup it avoids autocompletion, imports validation and stuff like that:

bildschirmfoto 2017-07-28 um 15 58 19

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions