[K1] Correctly handle case when expect annotation is unresolved
Before change NPE was thrown. Review: KT-MR-12250 ^KT-62026
This commit is contained in:
committed by
Space Team
parent
5cae87b263
commit
04c1bf749c
+6
@@ -938,6 +938,12 @@ public class FirOldFrontendMPPDiagnosticsWithLightTreeTestGenerated extends Abst
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/annotationMatching/typealiasToKtLibrary.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("unresolvedReference.kt")
|
||||
public void testUnresolvedReference() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/annotationMatching/unresolvedReference.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("valueParameters.kt")
|
||||
public void testValueParameters() throws Exception {
|
||||
|
||||
+6
@@ -938,6 +938,12 @@ public class FirOldFrontendMPPDiagnosticsWithPsiTestGenerated extends AbstractFi
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/annotationMatching/typealiasToKtLibrary.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("unresolvedReference.kt")
|
||||
public void testUnresolvedReference() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/annotationMatching/unresolvedReference.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("valueParameters.kt")
|
||||
public void testValueParameters() throws Exception {
|
||||
|
||||
+4
@@ -25,6 +25,7 @@ import org.jetbrains.kotlin.resolve.scopes.MemberScope
|
||||
import org.jetbrains.kotlin.resolve.scopes.getDescriptorsFiltered
|
||||
import org.jetbrains.kotlin.types.*
|
||||
import org.jetbrains.kotlin.types.checker.*
|
||||
import org.jetbrains.kotlin.types.error.ErrorClassDescriptor
|
||||
import org.jetbrains.kotlin.types.model.KotlinTypeMarker
|
||||
import org.jetbrains.kotlin.types.model.TypeConstructorMarker
|
||||
import org.jetbrains.kotlin.types.model.TypeSubstitutorMarker
|
||||
@@ -389,6 +390,9 @@ class ClassicExpectActualMatchingContext(
|
||||
|
||||
private fun getAnnotationClassDescriptor(): ClassDescriptor? {
|
||||
val classDescriptor = annotationDescriptor.annotationClass ?: return null
|
||||
if (classDescriptor is ErrorClassDescriptor) {
|
||||
return null
|
||||
}
|
||||
if (!classDescriptor.isExpect) {
|
||||
return classDescriptor
|
||||
}
|
||||
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
// DIAGNOSTICS: -UNRESOLVED_REFERENCE
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
@NonExistingClass
|
||||
expect fun foo()
|
||||
|
||||
// MODULE: m1-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
actual fun <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>foo<!>() {}
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
// DIAGNOSTICS: -UNRESOLVED_REFERENCE
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
@NonExistingClass
|
||||
expect fun foo()
|
||||
|
||||
// MODULE: m1-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
actual fun foo() {}
|
||||
Generated
+6
@@ -23939,6 +23939,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/annotationMatching/typealiasToKtLibrary.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("unresolvedReference.kt")
|
||||
public void testUnresolvedReference() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/annotationMatching/unresolvedReference.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("valueParameters.kt")
|
||||
public void testValueParameters() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user