From b3aadfd5e06a53818c6331046cf07da57d763e59 Mon Sep 17 00:00:00 2001 From: Stanislav Erokhin Date: Thu, 23 Apr 2015 17:31:07 +0300 Subject: [PATCH] Performance workaround for assert call. --- .../src/org/jetbrains/kotlin/types/flexibleTypes.kt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/core/descriptors/src/org/jetbrains/kotlin/types/flexibleTypes.kt b/core/descriptors/src/org/jetbrains/kotlin/types/flexibleTypes.kt index cc5812900a1..47f32644c2c 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/types/flexibleTypes.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/types/flexibleTypes.kt @@ -153,11 +153,13 @@ public open class DelegatingFlexibleType protected ( } init { - assert (!lowerBound.isFlexible()) { "Lower bound of a flexible type can not be flexible: $lowerBound" } - assert (!upperBound.isFlexible()) { "Upper bound of a flexible type can not be flexible: $upperBound" } - assert (lowerBound != upperBound) { "Lower and upper bounds are equal: $lowerBound == $upperBound" } - assert (JetTypeChecker.DEFAULT.isSubtypeOf(lowerBound, upperBound)) { - "Lower bound $lowerBound of a flexible type must be a subtype of the upper bound $upperBound" + if (ASSERTIONS_ENABLED) { // workaround for KT-7540 + assert (!lowerBound.isFlexible()) { "Lower bound of a flexible type can not be flexible: $lowerBound" } + assert (!upperBound.isFlexible()) { "Upper bound of a flexible type can not be flexible: $upperBound" } + assert (lowerBound != upperBound) { "Lower and upper bounds are equal: $lowerBound == $upperBound" } + assert (JetTypeChecker.DEFAULT.isSubtypeOf(lowerBound, upperBound)) { + "Lower bound $lowerBound of a flexible type must be a subtype of the upper bound $upperBound" + } } }