From b675b49daf7f3f002ce8bff0c9ee8c675d52a1a4 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Mon, 11 Jul 2016 18:47:19 +0300 Subject: [PATCH] Specify type explicitly: do not consider star projection arguments in KotlinType.isFlexibleRecursive() #KT-13055 Fixed (cherry picked from commit 828f4bf) --- .../idea/intentions/SpecifyTypeExplicitlyIntention.kt | 2 +- .../inspections/hasPlatformType/recursiveGeneric.kt | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 idea/testData/inspections/hasPlatformType/recursiveGeneric.kt diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/SpecifyTypeExplicitlyIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/SpecifyTypeExplicitlyIntention.kt index 07e47f16940..5ebafb150e4 100644 --- a/idea/src/org/jetbrains/kotlin/idea/intentions/SpecifyTypeExplicitlyIntention.kt +++ b/idea/src/org/jetbrains/kotlin/idea/intentions/SpecifyTypeExplicitlyIntention.kt @@ -51,7 +51,7 @@ class SpecifyTypeExplicitlyIntention : private fun KotlinType.isFlexibleRecursive(): Boolean { if (isFlexible()) return true - return arguments.any { it.type.isFlexibleRecursive() } + return arguments.any { !it.isStarProjection && it.type.isFlexibleRecursive() } } fun dangerousFlexibleTypeOrNull(declaration: KtCallableDeclaration, publicAPIOnly: Boolean): KotlinType? { diff --git a/idea/testData/inspections/hasPlatformType/recursiveGeneric.kt b/idea/testData/inspections/hasPlatformType/recursiveGeneric.kt new file mode 100644 index 00000000000..9221c791e39 --- /dev/null +++ b/idea/testData/inspections/hasPlatformType/recursiveGeneric.kt @@ -0,0 +1,7 @@ +// KT-13055: SOE in isFlexibleRecursive +interface Rec> { + fun t(): T +} +interface Super { + fun foo(p: Rec<*, *>) = p.t() +} \ No newline at end of file