diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/types/inference/ConstraintSystemImpl.java b/compiler/frontend/src/org/jetbrains/jet/lang/types/inference/ConstraintSystemImpl.java index c5aff27be5c..e9984635f3a 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/types/inference/ConstraintSystemImpl.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/types/inference/ConstraintSystemImpl.java @@ -267,9 +267,15 @@ public class ConstraintSystemImpl implements ConstraintSystem { @Override public boolean noCorrespondingSupertype(@NotNull JetType subtype, @NotNull JetType supertype) { - // If some of the types is an unknown, the constraint is already generated, and we should carry on + // If some of the types is an unknown, the constraint must be generated, and we should carry on // otherwise there can be no solution, and we should fail - return someUnknown(getTypeValueFor(subtype), getTypeValueFor(supertype)); + TypeValue subTypeValue = getTypeValueFor(subtype); + TypeValue superTypeValue = getTypeValueFor(supertype); + boolean someUnknown = someUnknown(subTypeValue, superTypeValue); + if (someUnknown) { + addSubtypingConstraintOnTypeValues(subTypeValue, superTypeValue); + } + return someUnknown; } private boolean someUnknown(TypeValue subtypeValue, TypeValue supertypeValue) { diff --git a/compiler/testData/checkerWithErrorTypes/quick/regressions/kt630.jet b/compiler/testData/checkerWithErrorTypes/quick/regressions/kt630.jet new file mode 100644 index 00000000000..840941d9807 --- /dev/null +++ b/compiler/testData/checkerWithErrorTypes/quick/regressions/kt630.jet @@ -0,0 +1,3 @@ +// KT-630 Bad type inference +val x = "lala".sure() +val s : String = x \ No newline at end of file