Switching off propagation of types and KotlinSignatures for platform types

This commit is contained in:
Andrey Breslav
2014-06-24 17:54:32 +04:00
parent fefadaa171
commit c3c72fc528
7 changed files with 145 additions and 10 deletions
@@ -76,11 +76,11 @@ public class TypeCheckingProcedure {
return equalTypes(flexibleType1.getLowerBound(), flexibleType2.getLowerBound())
&& equalTypes(flexibleType1.getUpperBound(), flexibleType2.getUpperBound());
}
return equalTypes(flexibleType1.getLowerBound(), type2) || equalTypes(flexibleType1.getUpperBound(), type2);
return heterogeneousEquivalence(type2, flexibleType1);
}
else if (type2 instanceof FlexibleType) {
FlexibleType flexibleType2 = (FlexibleType) type2;
return equalTypes(type1, flexibleType2.getLowerBound()) || equalTypes(type1, flexibleType2.getUpperBound());
return heterogeneousEquivalence(type1, flexibleType2);
}
if (type1.isNullable() != type2.isNullable()) {
@@ -121,6 +121,12 @@ public class TypeCheckingProcedure {
return true;
}
private boolean heterogeneousEquivalence(JetType inflexibleType, FlexibleType flexibleType) {
// This is to account for the case when we have Collection<X> vs (Mutable)Collection<X>! or K(java.util.Collection<? extends X>)
assert !TypesPackage.isFlexible(inflexibleType) : "Only inflexible types are allowed here: " + inflexibleType;
return isSubtypeOf(flexibleType.getLowerBound(), inflexibleType) && isSubtypeOf(inflexibleType, flexibleType.getUpperBound());
}
public enum EnrichedProjectionKind {
IN, OUT, INV, STAR;