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

Unification error regarding abstracts #5279

Closed
kevinresol opened this issue May 26, 2016 · 2 comments
Closed

Unification error regarding abstracts #5279

kevinresol opened this issue May 26, 2016 · 2 comments
Assignees

Comments

@kevinresol
Copy link
Contributor

kevinresol commented May 26, 2016

I tried but can't reduce it to not depend on a library. I am not sure what's happening behind the hood.
(Not regression)

-lib tink_core

package;

using tink.CoreApi;

class Main {
    public static function main() {

        var a:Surprise<String, ErrorAbstract> = null;
        var r:Response = a; // compiler complains: tink.Surprise<String, ErrorAbstract> should be Response
    }
}


typedef Rep = Surprise<String, Error>;
abstract Response(Rep) from Rep to Rep {}
abstract ErrorAbstract(Error) from Error to Error {}
@kevinresol
Copy link
Contributor Author

Not sure if it is related, here is another problem.
The following code does not compile:

package;

class Main {
    public static function main() {
        function test() //:Int (works if explicitly hint return type as Int)
            return if (true) getInt() else getAbstract();
    }

    static function getInt():Int return 1;
    static function getAbstract():MyAbstract return "1";
}
abstract MyAbstract(String) from String to String {
    @:to
    public inline function toInt():Int return Std.parseInt(this);
}

@Simn Simn added this to the 3.4 milestone May 31, 2016
@Simn Simn self-assigned this May 31, 2016
@Simn Simn modified the milestones: 3.4, 4.0 Jan 9, 2017
@Simn Simn modified the milestones: Release 4.0, Bugs Apr 17, 2018
@RealyUniqueName
Copy link
Member

Original issue described in start post is about abstracts transitive casts. Let's track it here: #5997
For the second post I created a separate issue: #8479

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

3 participants