// KT-630 Bad type inference

This commit is contained in:
Andrey Breslav
2011-11-30 11:02:03 +03:00
parent 82bddcc95b
commit 5293d1553b
2 changed files with 11 additions and 2 deletions
@@ -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) {
@@ -0,0 +1,3 @@
// KT-630 Bad type inference
val x = "lala".sure()
val s : String = x