[K2]: Support java-kotlin interop for @SubclassOptInRequired

Previously, if the parent class was in Java code and the subclass in
Kotlin, the opt-in usage error would not be reported for the subclass.
The problem was that the extractClassFromArgument function couldn't get
the class type from Java code. It was looking for a ConeClassLikeType,
but found a ConeFlexibleType instead.

#KT-60258 Fixed
This commit is contained in:
Anastasia.Nekrasova
2024-01-12 15:51:18 +02:00
committed by Space Team
parent 9fafbc1b07
commit 8156c91c47
8 changed files with 63 additions and 4 deletions
@@ -0,0 +1,13 @@
// FILE: one.java
package pcg;
import kotlin.ExperimentalMultiplatform;
import kotlin.SubclassOptInRequired;
@SubclassOptInRequired(markerClass = ExperimentalMultiplatform.class) public class Foo{}
// FILE: two.kt
import pcg.Foo
class Bar() : <!OPT_IN_USAGE_ERROR!>Foo<!>()
@@ -0,0 +1,14 @@
// FILE: one.java
package pcg;
import kotlin.ExperimentalMultiplatform;
import kotlin.SubclassOptInRequired;
@SubclassOptInRequired(markerClass = ExperimentalMultiplatform.class) public class Foo{}
// FILE: two.kt
import pcg.Foo
class Bar() : Foo()