From 6680f01cfe1b68b09ea7641638ef8a6d1da7d588 Mon Sep 17 00:00:00 2001 From: Stanislav Erokhin Date: Sat, 8 Jul 2017 23:25:08 +0300 Subject: [PATCH] [NI] Fix assertion error at FlexibleTypeImpl Use KotlinTypeFactory for FlexibleType creation --- .../kotlin/resolve/calls/NewCommonSuperTypeCalculator.kt | 2 +- .../resolve/calls/inference/components/NewTypeSubstitutor.kt | 2 +- .../src/org/jetbrains/kotlin/types/TypeApproximator.kt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/NewCommonSuperTypeCalculator.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/NewCommonSuperTypeCalculator.kt index a7925ef2f9e..8107fd2e28b 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/NewCommonSuperTypeCalculator.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/NewCommonSuperTypeCalculator.kt @@ -53,7 +53,7 @@ object NewCommonSuperTypeCalculator { if (!thereIsFlexibleTypes) return lowerSuperType val upperSuperType = commonSuperTypeForSimpleTypes(types.map { it.upperIfFlexible() }, depth) - return FlexibleTypeImpl(lowerSuperType, upperSuperType) + return KotlinTypeFactory.flexibleType(lowerSuperType, upperSuperType) } private fun commonSuperTypeForSimpleTypes(types: List, depth: Int): SimpleType { diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/components/NewTypeSubstitutor.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/components/NewTypeSubstitutor.kt index 2b8a8210d6b..5f23c8b1088 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/components/NewTypeSubstitutor.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/components/NewTypeSubstitutor.kt @@ -46,7 +46,7 @@ interface NewTypeSubstitutor { } else { // todo discuss lowerIfFlexible and upperIfFlexible - FlexibleTypeImpl(lowerBound?.lowerIfFlexible() ?: type.lowerBound, upperBound?.upperIfFlexible() ?: type.upperBound) + KotlinTypeFactory.flexibleType(lowerBound?.lowerIfFlexible() ?: type.lowerBound, upperBound?.upperIfFlexible() ?: type.upperBound) } } } diff --git a/compiler/resolution/src/org/jetbrains/kotlin/types/TypeApproximator.kt b/compiler/resolution/src/org/jetbrains/kotlin/types/TypeApproximator.kt index b6ba1793788..30f52eb8adf 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/types/TypeApproximator.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/types/TypeApproximator.kt @@ -152,7 +152,7 @@ class TypeApproximator { * * If U_1 <: U_2.lower .. U_2.upper, then we know only that U_1 <: U_2.upper. */ - return FlexibleTypeImpl(lowerResult?.lowerIfFlexible() ?: type.lowerBound, + return KotlinTypeFactory.flexibleType(lowerResult?.lowerIfFlexible() ?: type.lowerBound, upperResult?.upperIfFlexible() ?: type.upperBound) } else {