From 3793e485b6eee9cdb379f72d11b4a25a523c90fb Mon Sep 17 00:00:00 2001 From: Dmitry Savvinov Date: Fri, 15 May 2020 18:12:01 +0300 Subject: [PATCH] Check for common klibs builtins_platform properly Actually, common klibs don't have a corresponding record (and abscence of that record should be treated as platform COMMON). ^KT-38769 Fixed --- .../src/org/jetbrains/kotlin/idea/klib/utils.kt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/klib/utils.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/klib/utils.kt index 69efdffd7e5..6f306b185cd 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/klib/utils.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/klib/utils.kt @@ -62,10 +62,13 @@ private fun checkKlibComponent(componentFile: VirtualFile, requestedBuiltInsPlat if (!manifestProperties.containsKey(KLIB_PROPERTY_UNIQUE_NAME)) return false - // No builtins_platform property => either a new common klib (we don't write builtins_platform for common) or old Native klib val builtInsPlatformProperty = manifestProperties.getProperty(KLIB_PROPERTY_BUILTINS_PLATFORM) - // TODO(dsavvinov): drop additional legacy check after 1.4 - ?: return requestedBuiltInsPlatform == BuiltInsPlatform.NATIVE && componentFile.isLegacyNativeKlibComponent + // No builtins_platform property => either a new common klib (we don't write builtins_platform for common) or old Native klib + ?: return when (requestedBuiltInsPlatform) { + BuiltInsPlatform.NATIVE -> componentFile.isLegacyNativeKlibComponent // TODO(dsavvinov): drop additional legacy check after 1.4 + BuiltInsPlatform.COMMON -> !componentFile.isLegacyNativeKlibComponent + else -> false + } val builtInsPlatform = BuiltInsPlatform.parseFromString(builtInsPlatformProperty) ?: return false