Do not report OPTIONAL_DECLARATION_USAGE_... in IDE for platform modules
#KT-26585 Fixed Also fixes MultiPlatformHighlightingTestGenerated.testMultifileFacade
This commit is contained in:
+5
-1
@@ -9,6 +9,9 @@ import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.kotlin.descriptors.ClassifierDescriptor
|
||||
import org.jetbrains.kotlin.diagnostics.Errors
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.resolve.MultiTargetPlatform
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.module
|
||||
import org.jetbrains.kotlin.resolve.getMultiTargetPlatform
|
||||
import org.jetbrains.kotlin.resolve.multiplatform.isCommonSource
|
||||
|
||||
class OptionalExpectationUsageChecker : ClassifierUsageChecker {
|
||||
@@ -20,7 +23,8 @@ class OptionalExpectationUsageChecker : ClassifierUsageChecker {
|
||||
}
|
||||
|
||||
val ktFile = element.containingFile as KtFile
|
||||
if (ktFile.isCommonSource != true) {
|
||||
// The first part is for the compiler, and the second one is for IDE
|
||||
if (ktFile.isCommonSource != true && targetDescriptor.module.getMultiTargetPlatform() != MultiTargetPlatform.Common) {
|
||||
context.trace.report(Errors.OPTIONAL_DECLARATION_USAGE_IN_NON_COMMON_SOURCE.on(element))
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
@kotlin.jvm.JvmName("declarationFunName")
|
||||
fun declaration() { }
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
// !CHECK_HIGHLIGHTING
|
||||
|
||||
fun test() {
|
||||
declaration()
|
||||
}
|
||||
Generated
+5
@@ -109,6 +109,11 @@ public class MultiPlatformHighlightingTestGenerated extends AbstractMultiPlatfor
|
||||
runTest("idea/testData/multiModuleHighlighting/multiplatform/jvmKotlinReferencesCommonKotlinThroughJavaDifferentJvmImpls/");
|
||||
}
|
||||
|
||||
@TestMetadata("jvmNameInCommon")
|
||||
public void testJvmNameInCommon() throws Exception {
|
||||
runTest("idea/testData/multiModuleHighlighting/multiplatform/jvmNameInCommon/");
|
||||
}
|
||||
|
||||
@TestMetadata("multifileFacade")
|
||||
public void testMultifileFacade() throws Exception {
|
||||
runTest("idea/testData/multiModuleHighlighting/multiplatform/multifileFacade/");
|
||||
|
||||
Reference in New Issue
Block a user