Lower bound must be a subtype of the upper bound.

The change in CommonSupertypes:

 We used to say that commonSupertype(Inv<A>, Inv<B>) = Inv<in Intersect(A, B)). This is counter-intuitive, should be Inv<out commonSupertype(A, B)>
This commit is contained in:
Andrey Breslav
2014-08-25 17:51:02 +04:00
parent e232697da1
commit 6cb1d2e3f7
4 changed files with 16 additions and 8 deletions
@@ -200,6 +200,8 @@ public class JetTypeCheckerTest extends JetLiteFixture {
assertCommonSupertype("Base_T<in Int>", "Derived_T<Int>", "Base_T<in Int>");
assertCommonSupertype("Base_T<in Int>", "Derived_T<in Int>", "Base_T<Int>");
assertCommonSupertype("Base_T<*>", "Base_T<Int>", "Base_T<*>");
assertCommonSupertype("Base_T<out Parent>", "Base_T<A>", "Base_T<B>");
}
public void testIntersect() throws Exception {