From 070dba69fab35da21cfdf34d86c8a659414234bd Mon Sep 17 00:00:00 2001 From: Svetlana Isakova Date: Tue, 2 Dec 2014 15:14:48 +0300 Subject: [PATCH] Don't add a constraint T <: DONT_CARE from upper bounds --- .../constraintSystem/severalVariables/simpleDependency.bounds | 2 +- .../jet/lang/resolve/calls/inference/ConstraintSystemImpl.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/testData/constraintSystem/severalVariables/simpleDependency.bounds b/compiler/testData/constraintSystem/severalVariables/simpleDependency.bounds index 8469234f4fe..d8a26467e48 100644 --- a/compiler/testData/constraintSystem/severalVariables/simpleDependency.bounds +++ b/compiler/testData/constraintSystem/severalVariables/simpleDependency.bounds @@ -4,7 +4,7 @@ SUBTYPE T Int type parameter bounds: T <: kotlin.Int(SPECIAL) -P <: ???(TYPE_BOUND_POSITION(1)), <: kotlin.Int(COMPOUND_CONSTRAINT_POSITION(TYPE_BOUND_POSITION(1), SPECIAL) +P <: kotlin.Int(COMPOUND_CONSTRAINT_POSITION(TYPE_BOUND_POSITION(1), SPECIAL) status: -hasCannotCaptureTypesError: false -hasConflictingConstraints: false diff --git a/core/descriptors/src/org/jetbrains/jet/lang/resolve/calls/inference/ConstraintSystemImpl.kt b/core/descriptors/src/org/jetbrains/jet/lang/resolve/calls/inference/ConstraintSystemImpl.kt index b32759e918b..0dda4bcd93b 100644 --- a/core/descriptors/src/org/jetbrains/jet/lang/resolve/calls/inference/ConstraintSystemImpl.kt +++ b/core/descriptors/src/org/jetbrains/jet/lang/resolve/calls/inference/ConstraintSystemImpl.kt @@ -149,7 +149,7 @@ public class ConstraintSystemImpl : ConstraintSystem { for (declaredUpperBound in typeVariable.getUpperBounds()) { if (KotlinBuiltIns.getInstance().getNullableAnyType() == declaredUpperBound) continue //todo remove this line (?) val substitutedBound = constantSubstitutor?.substitute(declaredUpperBound, Variance.INVARIANT) - if (substitutedBound != null) { + if (substitutedBound != null && !isErrorOrSpecialType(substitutedBound)) { typeBounds.addBound(UPPER_BOUND, substitutedBound, TYPE_BOUND_POSITION.position(typeVariable.getIndex())) } }