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

redundant self type is unusable #1399

Open
jvasileff opened this issue Aug 13, 2015 · 4 comments
Open

redundant self type is unusable #1399

jvasileff opened this issue Aug 13, 2015 · 4 comments
Assignees
Labels
Milestone

Comments

@jvasileff
Copy link
Member

I'm not sure what to make of this, but a value that satisfies a self type two different ways cannot be used:

void boxIntersection<I>(I i)
        given I satisfies Summable<I> {

    assert (is Integer i);

    print(i + i);
    // Right operand must be of compatible summable type:
    // type cannot be determined

    print((i of Integer) + i); // ok
    print((i of I) + i); // ok
}
@gavinking
Copy link
Member

Ahahahaha, I was confused for a sec, but then I realized you just ran into our famous case of not being able to form a principal instantiation for the intersection of two instantiations of an invariant type where in one instantiation the type arg is a type parameter. A corner case that @RossTate first pointed out.

@gavinking
Copy link
Member

So I'm not sure if there's anything I really should do about this one. What I mean is: while I could surely write some complicated code to ad hoc detect this corner case and let it in, it's not clear to me that this would be worth the effort. I mean, the workaround is pretty trivial really.

Anyway, I don't think it's blocking the 1.2 release.

@gavinking gavinking modified the milestones: 1.3, 1.2 Oct 1, 2015
@jvasileff
Copy link
Member Author

Ok, yeah, interesting.

@RossTate
Copy link
Member

RossTate commented Oct 1, 2015

psychic 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants