Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

redundant self type is unusable #4505

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

redundant self type is unusable #4505

CeylonMigrationBot opened this issue Aug 13, 2015 · 4 comments

Comments

@CeylonMigrationBot
Copy link

[@jvasileff] 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
}

[Migrated from ceylon/ceylon-spec#1399]

@CeylonMigrationBot
Copy link
Author

[@gavinking] 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.

@CeylonMigrationBot
Copy link
Author

[@gavinking] 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.

@CeylonMigrationBot
Copy link
Author

[@jvasileff] Ok, yeah, interesting.

@CeylonMigrationBot
Copy link
Author

[@RossTate] psychic 😄

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

No branches or pull requests

2 participants