Not get supertypes of Nothing

(exception EA-37833)
This commit is contained in:
Svetlana Isakova
2012-08-22 12:34:57 +04:00
parent 11fdeac930
commit 5779ac15c0
3 changed files with 22 additions and 0 deletions
@@ -27,6 +27,7 @@ import org.jetbrains.jet.lang.descriptors.TypeParameterDescriptor;
import org.jetbrains.jet.lang.types.*;
import org.jetbrains.jet.lang.types.checker.TypeCheckingProcedure;
import org.jetbrains.jet.lang.resolve.calls.inference.TypeConstraintsImpl.ConstraintKind;
import org.jetbrains.jet.lang.types.lang.JetStandardClasses;
import java.util.*;
@@ -190,6 +191,7 @@ public class ConstraintSystemImpl implements ConstraintSystem {
}
switch (constraintKind) {
case SUPER_TYPE: {
if (JetStandardClasses.isNothingOrNullableNothing(constrainingType)) break;
JetType correspondingSupertype = TypeCheckingProcedure.findCorrespondingSupertype(constrainingType, subjectType);
if (correspondingSupertype != null) {
constrainingType = correspondingSupertype;
@@ -197,6 +199,7 @@ public class ConstraintSystemImpl implements ConstraintSystem {
break;
}
case SUB_TYPE: {
if (JetStandardClasses.isNothingOrNullableNothing(subjectType)) break;
JetType correspondingSupertype = TypeCheckingProcedure.findCorrespondingSupertype(subjectType, constrainingType);
if (correspondingSupertype != null) {
subjectType = correspondingSupertype;