From a2a1c7e50f537c731418326560de45e0860b80d6 Mon Sep 17 00:00:00 2001 From: Denis Zharkov Date: Fri, 12 Jul 2019 14:01:36 +0300 Subject: [PATCH] Avoid recursive refinement with star projections Otherwise StackOverflowError or recursion-detection in LockBasedStorageManager may happen It's fine to have non-refined type there because it only can affect content of containing type member scope that should be refined after being requested --- .../src/org/jetbrains/kotlin/types/StarProjectionImpl.kt | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/core/descriptors/src/org/jetbrains/kotlin/types/StarProjectionImpl.kt b/core/descriptors/src/org/jetbrains/kotlin/types/StarProjectionImpl.kt index eca738f72cd..fa3a2957542 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/types/StarProjectionImpl.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/types/StarProjectionImpl.kt @@ -37,9 +37,7 @@ class StarProjectionImpl( override fun getType() = _type @TypeRefinement - override fun refine(kotlinTypeRefiner: KotlinTypeRefiner): TypeProjection = - TypeBasedStarProjectionImpl(kotlinTypeRefiner.refineType(type)) - + override fun refine(kotlinTypeRefiner: KotlinTypeRefiner): TypeProjection = this } fun TypeParameterDescriptor.starProjectionType(): KotlinType { @@ -66,6 +64,5 @@ class TypeBasedStarProjectionImpl( override fun getType() = _type @TypeRefinement - override fun refine(kotlinTypeRefiner: KotlinTypeRefiner): TypeProjection = - TypeBasedStarProjectionImpl(kotlinTypeRefiner.refineType(_type)) + override fun refine(kotlinTypeRefiner: KotlinTypeRefiner): TypeProjection = this }