Specificity supported for dynamic types

This commit is contained in:
Andrey Breslav
2014-11-09 14:05:58 +02:00
parent 20513abe04
commit 65794183e7
7 changed files with 75 additions and 4 deletions
@@ -22,6 +22,7 @@ import org.jetbrains.jet.lang.descriptors.ConstructorDescriptor;
import org.jetbrains.jet.lang.descriptors.SimpleFunctionDescriptor;
import org.jetbrains.jet.lang.descriptors.PropertyDescriptor;
import org.jetbrains.jet.lang.types.JetType;
import org.jetbrains.jet.lang.types.TypesPackage;
import org.jetbrains.jet.lang.types.checker.JetTypeChecker;
import java.util.List;
@@ -70,8 +71,8 @@ public class OverloadUtil {
for (int i = 0; i < superValueParameters.size(); ++i) {
JetType superValueParameterType = OverridingUtil.getUpperBound(superValueParameters.get(i));
JetType subValueParameterType = OverridingUtil.getUpperBound(subValueParameters.get(i));
// TODO: compare erasure
if (!JetTypeChecker.DEFAULT.equalTypes(superValueParameterType, subValueParameterType)) {
if (!JetTypeChecker.DEFAULT.equalTypes(superValueParameterType, subValueParameterType)
|| TypesPackage.oneMoreSpecificThanAnother(subValueParameterType, superValueParameterType)) {
return OverridingUtil.OverrideCompatibilityInfo
.valueParameterTypeMismatch(superValueParameterType, subValueParameterType, INCOMPATIBLE);
}