From 0f60b5a71e8c7dbfbeafae369b0a32afad6a692d Mon Sep 17 00:00:00 2001 From: Dmitriy Dolovov Date: Thu, 2 Apr 2020 14:12:21 +0700 Subject: [PATCH] HMPP: Avoid false positive detection of "common native" as "common" --- .../src/org/jetbrains/kotlin/platform/TargetPlatform.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/descriptors/src/org/jetbrains/kotlin/platform/TargetPlatform.kt b/core/descriptors/src/org/jetbrains/kotlin/platform/TargetPlatform.kt index 4171238eaa2..b2452f7e300 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/platform/TargetPlatform.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/platform/TargetPlatform.kt @@ -77,7 +77,13 @@ interface TargetPlatformVersion { } } -fun TargetPlatform?.isCommon(): Boolean = this != null && this.size > 1 +fun TargetPlatform?.isCommon(): Boolean = this != null && size > 1 && iterator().let { i -> + val firstPlatformName = i.next().platformName + while (i.hasNext()) { + if (i.next().platformName != firstPlatformName) return@let true + } + false +} fun SimplePlatform.toTargetPlatform(): TargetPlatform = TargetPlatform(setOf(this))