[FE] Implement FE logic of expect actual annotations matching

This implementation only checks annotations set on expect/actual
declarations and requires further refinement (e.g. checking of other
annotation targets, class scopes within typealiases).

^KT-58551
This commit is contained in:
Roman Efremov
2023-06-22 15:22:17 +02:00
committed by Space Team
parent b1bdb619d8
commit 1a4ab9bb4b
49 changed files with 1481 additions and 25 deletions
@@ -0,0 +1,138 @@
// WITH_STDLIB
// MODULE: m1-common
// FILE: common.kt
package test
import kotlin.reflect.KClass
annotation class ClassArgAnn(val clazz: KClass<*>)
class ClassForReference {
class ClassForReference
}
@ClassArgAnn(ClassForReference::class)
expect fun getClassExpression()
@ClassArgAnn(ClassForReference.ClassForReference::class)
expect fun differentClassesWithSameName()
annotation class StringArgAnn(val s: String)
@StringArgAnn("1.9")
expect fun stringConstant()
@StringArgAnn("1" + ".9")
expect fun stringConcatentation()
object Constants {
const val STR = "1"
}
@StringArgAnn(Constants.STR)
expect fun constantFromInsideObject()
@StringArgAnn(Constants.STR + ".9")
expect fun stringConcatentationWithProperty()
enum class MyEnum { FOO, BAR }
annotation class EnumArgAnn(val e: MyEnum)
@EnumArgAnn(MyEnum.FOO)
expect fun enumArg()
annotation class VarargAnn(vararg val strings: String)
@VarargAnn("foo", "bar")
expect fun varargInAnnotation()
@VarargAnn(*["foo", "bar"])
expect fun varargInAnnotationWithArraySpread()
annotation class ArrayArgAnn(val strings: Array<String>)
@ArrayArgAnn(["foo", "bar"])
expect fun arrayInAnnotation()
@ArrayArgAnn(["foo", "bar"])
expect fun arrayInAnnotationNotMatch()
annotation class NestedAnnArg(val text: String, vararg val children: NestedAnnArg)
@NestedAnnArg(
text = "root",
NestedAnnArg("1"),
NestedAnnArg("2",
NestedAnnArg("2.1"),
NestedAnnArg("2.2")
)
)
expect fun complexNestedAnnotations()
@NestedAnnArg(
text = "root",
NestedAnnArg("1"),
NestedAnnArg("2",
NestedAnnArg("2.1"),
NestedAnnArg("2.2")
)
)
expect fun complexNestedAnnotationsNotMatch()
// MODULE: m1-jvm()()(m1-common)
// FILE: jvm.kt
package test
@ClassArgAnn(ClassForReference::class)
actual fun getClassExpression() {}
@ClassArgAnn(ClassForReference::class)
actual fun differentClassesWithSameName() {}
@StringArgAnn("1.9")
actual fun stringConstant() {}
@StringArgAnn("1.9")
actual fun stringConcatentation() {}
@StringArgAnn("1")
actual fun constantFromInsideObject() {}
@StringArgAnn("1.9")
actual fun stringConcatentationWithProperty() {}
@EnumArgAnn(MyEnum.FOO)
actual fun enumArg() {}
@VarargAnn("foo", "bar")
actual fun varargInAnnotation() {}
@VarargAnn("foo", "bar")
actual fun varargInAnnotationWithArraySpread() {}
@ArrayArgAnn(arrayOf("foo", "bar"))
actual fun arrayInAnnotation() {}
@ArrayArgAnn(["foo"])
actual fun arrayInAnnotationNotMatch() {}
@NestedAnnArg(
text = "root",
NestedAnnArg("1"),
NestedAnnArg("2",
NestedAnnArg("2.1"),
NestedAnnArg("2.2")
)
)
actual fun complexNestedAnnotations() {}
@NestedAnnArg(
text = "root",
NestedAnnArg("1"),
NestedAnnArg("2",
NestedAnnArg("2.1"),
NestedAnnArg("DIFFERENT")
)
)
actual fun complexNestedAnnotationsNotMatch() {}
@@ -0,0 +1,138 @@
// WITH_STDLIB
// MODULE: m1-common
// FILE: common.kt
package test
import kotlin.reflect.KClass
annotation class ClassArgAnn(val clazz: KClass<*>)
class ClassForReference {
class ClassForReference
}
@ClassArgAnn(ClassForReference::class)
expect fun getClassExpression()
@ClassArgAnn(ClassForReference.ClassForReference::class)
expect fun differentClassesWithSameName()
annotation class StringArgAnn(val s: String)
@StringArgAnn("1.9")
expect fun stringConstant()
@StringArgAnn("1" + ".9")
expect fun stringConcatentation()
object Constants {
const val STR = "1"
}
@StringArgAnn(Constants.STR)
expect fun constantFromInsideObject()
@StringArgAnn(Constants.STR + ".9")
expect fun stringConcatentationWithProperty()
enum class MyEnum { FOO, BAR }
annotation class EnumArgAnn(val e: MyEnum)
@EnumArgAnn(MyEnum.FOO)
expect fun enumArg()
annotation class VarargAnn(vararg val strings: String)
@VarargAnn("foo", "bar")
expect fun varargInAnnotation()
@VarargAnn(*["foo", "bar"])
expect fun varargInAnnotationWithArraySpread()
annotation class ArrayArgAnn(val strings: Array<String>)
@ArrayArgAnn(["foo", "bar"])
expect fun arrayInAnnotation()
@ArrayArgAnn(["foo", "bar"])
expect fun arrayInAnnotationNotMatch()
annotation class NestedAnnArg(val text: String, vararg val children: NestedAnnArg)
@NestedAnnArg(
text = "root",
NestedAnnArg("1"),
NestedAnnArg("2",
NestedAnnArg("2.1"),
NestedAnnArg("2.2")
)
)
expect fun complexNestedAnnotations()
@NestedAnnArg(
text = "root",
NestedAnnArg("1"),
NestedAnnArg("2",
NestedAnnArg("2.1"),
NestedAnnArg("2.2")
)
)
expect fun complexNestedAnnotationsNotMatch()
// MODULE: m1-jvm()()(m1-common)
// FILE: jvm.kt
package test
@ClassArgAnn(ClassForReference::class)
actual fun getClassExpression() {}
@ClassArgAnn(ClassForReference::class)
actual fun <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>differentClassesWithSameName<!>() {}
@StringArgAnn("1.9")
actual fun stringConstant() {}
@StringArgAnn("1.9")
actual fun stringConcatentation() {}
@StringArgAnn("1")
actual fun constantFromInsideObject() {}
@StringArgAnn("1.9")
actual fun stringConcatentationWithProperty() {}
@EnumArgAnn(MyEnum.FOO)
actual fun enumArg() {}
@VarargAnn("foo", "bar")
actual fun varargInAnnotation() {}
@VarargAnn("foo", "bar")
actual fun varargInAnnotationWithArraySpread() {}
@ArrayArgAnn(arrayOf("foo", "bar"))
actual fun arrayInAnnotation() {}
@ArrayArgAnn(["foo"])
actual fun <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>arrayInAnnotationNotMatch<!>() {}
@NestedAnnArg(
text = "root",
NestedAnnArg("1"),
NestedAnnArg("2",
NestedAnnArg("2.1"),
NestedAnnArg("2.2")
)
)
actual fun complexNestedAnnotations() {}
@NestedAnnArg(
text = "root",
NestedAnnArg("1"),
NestedAnnArg("2",
NestedAnnArg("2.1"),
NestedAnnArg("DIFFERENT")
)
)
actual fun <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>complexNestedAnnotationsNotMatch<!>() {}
@@ -0,0 +1,12 @@
// FIR_IDENTICAL
// MODULE: m1-common
// FILE: common.kt
annotation class Ann(val p: String = "")
@Ann("")
expect fun explicitDefaultArgument()
// MODULE: m1-jvm()()(m1-common)
// FILE: jvm.kt
// No special handling for this case
@Ann
actual fun <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>explicitDefaultArgument<!>() {}
@@ -0,0 +1,101 @@
// MODULE: m1-common
// FILE: common.kt
annotation class Ann<T>
class A
class B
private object FakeA {
class A
}
@Ann<A>
expect fun sameTypeParam()
@Ann<B>
expect fun differentTypeParam()
@Ann<FakeA.A>
expect fun differentWithSameName()
@Ann<A?>
expect fun nonNullvsNull()
@Ann<Ann<in A>>
expect fun differentVariance()
@Ann<Ann<in A>>
expect fun varianceVsNoVariance()
@Ann<Ann<in A>>
expect fun sameVariance()
@Ann<Ann<*>>
expect fun startProjection()
annotation class ComplexNested<T>(
vararg val anns: ComplexNested<*>,
)
@ComplexNested<A>(
ComplexNested<A>(),
ComplexNested<A>(),
)
expect fun complexSame()
@ComplexNested<A>(
ComplexNested<A>(),
ComplexNested<B>(),
)
expect fun complexDiffer()
annotation class NestedWithSameTypeArgument<T>(
vararg val anns: NestedWithSameTypeArgument<T>
)
@NestedWithSameTypeArgument<A>(
NestedWithSameTypeArgument()
)
expect fun explicitVsInfered()
// MODULE: m1-jvm()()(m1-common)
// FILE: jvm.kt
@Ann<A>
actual fun sameTypeParam() {}
@Ann<A>
actual fun <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT, ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>differentTypeParam<!>() {}
@Ann<A>
actual fun <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT, ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>differentWithSameName<!>() {}
@Ann<A>
actual fun <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT, ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>nonNullvsNull<!>() {}
@Ann<Ann<out A>>
actual fun <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT, ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>differentVariance<!>() {}
@Ann<Ann<A>>
actual fun <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT, ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>varianceVsNoVariance<!>() {}
@Ann<Ann<in A>>
actual fun sameVariance() {}
@Ann<Ann<Any>>
actual fun <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT, ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>startProjection<!>() {}
@ComplexNested<A>(
ComplexNested<A>(),
ComplexNested<A>(),
)
actual fun complexSame() {}
@ComplexNested<A>(
ComplexNested<A>(),
ComplexNested<A>(),
)
actual fun <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>complexDiffer<!>() {}
@NestedWithSameTypeArgument<A>(
NestedWithSameTypeArgument<A>()
)
actual fun explicitVsInfered() {}
@@ -0,0 +1,101 @@
// MODULE: m1-common
// FILE: common.kt
annotation class Ann<T>
class A
class B
private object FakeA {
class A
}
@Ann<A>
expect fun sameTypeParam()
@Ann<B>
expect fun differentTypeParam()
@Ann<FakeA.A>
expect fun differentWithSameName()
@Ann<A?>
expect fun nonNullvsNull()
@Ann<Ann<in A>>
expect fun differentVariance()
@Ann<Ann<in A>>
expect fun varianceVsNoVariance()
@Ann<Ann<in A>>
expect fun sameVariance()
@Ann<Ann<*>>
expect fun startProjection()
annotation class ComplexNested<T>(
vararg val anns: ComplexNested<*>,
)
@ComplexNested<A>(
ComplexNested<A>(),
ComplexNested<A>(),
)
expect fun complexSame()
@ComplexNested<A>(
ComplexNested<A>(),
ComplexNested<B>(),
)
expect fun complexDiffer()
annotation class NestedWithSameTypeArgument<T>(
vararg val anns: NestedWithSameTypeArgument<T>
)
@NestedWithSameTypeArgument<A>(
NestedWithSameTypeArgument()
)
expect fun explicitVsInfered()
// MODULE: m1-jvm()()(m1-common)
// FILE: jvm.kt
@Ann<A>
actual fun sameTypeParam() {}
@Ann<A>
actual fun <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>differentTypeParam<!>() {}
@Ann<A>
actual fun <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>differentWithSameName<!>() {}
@Ann<A>
actual fun <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>nonNullvsNull<!>() {}
@Ann<Ann<out A>>
actual fun <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>differentVariance<!>() {}
@Ann<Ann<A>>
actual fun <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>varianceVsNoVariance<!>() {}
@Ann<Ann<in A>>
actual fun sameVariance() {}
@Ann<Ann<Any>>
actual fun <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>startProjection<!>() {}
@ComplexNested<A>(
ComplexNested<A>(),
ComplexNested<A>(),
)
actual fun complexSame() {}
@ComplexNested<A>(
ComplexNested<A>(),
ComplexNested<A>(),
)
actual fun complexDiffer() {}
@NestedWithSameTypeArgument<A>(
NestedWithSameTypeArgument<A>()
)
actual fun explicitVsInfered() {}
@@ -0,0 +1,42 @@
// FIR_IDENTICAL
// MODULE: m1-common
// FILE: common.kt
annotation class Ann
@Ann
expect class AnnotationMatching
@Ann
expect class AnnotationOnExpectOnly
expect class AnnotationOnActualOnly
expect class AnnotationInside {
@Ann
fun matches()
@Ann
fun onlyOnExpect()
fun onlyOnActual()
}
// MODULE: m1-jvm()()(m1-common)
// FILE: jvm.kt
@Ann
actual class AnnotationMatching
actual class <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>AnnotationOnExpectOnly<!>
@Ann
actual class AnnotationOnActualOnly
actual class AnnotationInside {
@Ann
actual fun matches() {}
actual fun <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>onlyOnExpect<!>() {}
@Ann
actual fun onlyOnActual() {}
}
@@ -0,0 +1,19 @@
// -- Module: <m1-common> --
// -- Module: <m1-jvm> --
/jvm.kt:24:14: warning: all annotations from `expect` must be presented with same arguments on `actual`, otherwise they have no effect.
Expected: @Ann public final expect class OnClass defined in root package in file common.kt
Actual: public final actual class OnClass defined in root package in file jvm.kt
actual class OnClass
^
/jvm.kt:27:16: warning: all annotations from `expect` must be presented with same arguments on `actual`, otherwise they have no effect.
Expected: @Ann public final expect fun onMember(): Unit defined in OnMember
Actual: public final actual fun onMember(): Unit defined in OnMember
actual fun onMember() {}
^
/jvm.kt:34:18: warning: all annotations from `expect` must be presented with same arguments on `actual`, otherwise they have no effect.
Expected: @Ann public final expect class ViaTypealias defined in root package in file common.kt
Actual: public final class ViaTypealiasImpl defined in root package in file jvm.kt
actual typealias ViaTypealias = ViaTypealiasImpl
^
@@ -0,0 +1,11 @@
/jvm.kt:(83,90): warning: All annotations from `expect` must be presented with same arguments on `actual`, otherwise they have no effect.
Expected: @Ann() public final expect class OnClass : Any
Actual: public final actual class OnClass : Any
/jvm.kt:(131,139): warning: All annotations from `expect` must be presented with same arguments on `actual`, otherwise they have no effect.
Expected: @Ann() public final expect fun onMember(): Unit
Actual: public final actual fun onMember(): Unit
/jvm.kt:(210,222): warning: All annotations from `expect` must be presented with same arguments on `actual`, otherwise they have no effect.
Expected: @Ann() public final expect class ViaTypealias : Any
Actual: public final class ViaTypealiasImpl : Any
@@ -0,0 +1,34 @@
// FIR_IDENTICAL
// RENDER_DIAGNOSTICS_FULL_TEXT
// MODULE: m1-common
// FILE: common.kt
annotation class Ann
@Ann
expect class OnClass
expect class OnMember {
@Ann
fun onMember()
}
@Ann
expect class ViaTypealias {
@Ann
fun foo()
}
// MODULE: m1-jvm()()(m1-common)
// FILE: jvm.kt
actual class <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>OnClass<!>
actual class OnMember {
actual fun <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>onMember<!>() {}
}
class ViaTypealiasImpl {
fun foo() {}
}
actual typealias <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>ViaTypealias<!> = ViaTypealiasImpl
@@ -0,0 +1,19 @@
// FIR_IDENTICAL
// MODULE: m1-common
// FILE: common.kt
annotation class Ann
expect class CompatibleOverrides {
fun foo()
@Ann
fun foo(withArg: Any)
}
// MODULE: m1-jvm()()(m1-common)
// FILE: jvm.kt
actual class CompatibleOverrides {
actual fun foo() {}
actual fun <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>foo<!>(withArg: Any) {}
}
@@ -0,0 +1,31 @@
// MODULE: m1-common
// FILE: common.kt
annotation class Ann1
annotation class Ann2
@Ann1
@Ann2
expect class AnnotationOrder
annotation class Ann3(vararg val numbers: Int)
@Ann3(1, 2)
expect class ValuesOrderInsideAnnotationArgument
annotation class Ann4(val arg1: String, val arg2: String)
@Ann4(arg1 = "1", arg2 = "2")
expect fun differentArgumentsOrder()
// MODULE: m1-jvm()()(m1-common)
// FILE: jvm.kt
@Ann2
@Ann1
actual class AnnotationOrder
@Ann3(2, 1)
actual class ValuesOrderInsideAnnotationArgument
@Ann4(arg2 = "2", arg1 = "1")
actual fun differentArgumentsOrder() {}
@@ -0,0 +1,31 @@
// MODULE: m1-common
// FILE: common.kt
annotation class Ann1
annotation class Ann2
@Ann1
@Ann2
expect class AnnotationOrder
annotation class Ann3(vararg val numbers: Int)
@Ann3(1, 2)
expect class ValuesOrderInsideAnnotationArgument
annotation class Ann4(val arg1: String, val arg2: String)
@Ann4(arg1 = "1", arg2 = "2")
expect fun differentArgumentsOrder()
// MODULE: m1-jvm()()(m1-common)
// FILE: jvm.kt
@Ann2
@Ann1
actual class AnnotationOrder
@Ann3(2, 1)
actual class <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>ValuesOrderInsideAnnotationArgument<!>
@Ann4(arg2 = "2", arg1 = "1")
actual fun differentArgumentsOrder() {}
@@ -0,0 +1,11 @@
// MODULE: m1-common
// FILE: common.kt
annotation class Ann(val p: Double)
@Ann(0.3)
expect fun floatNumbersComparison()
// MODULE: m1-jvm()()(m1-common)
// FILE: jvm.kt
@Ann(0.1 + 0.1 + 0.1)
actual fun floatNumbersComparison() {}
@@ -0,0 +1,11 @@
// MODULE: m1-common
// FILE: common.kt
annotation class Ann(val p: Double)
@Ann(0.3)
expect fun floatNumbersComparison()
// MODULE: m1-jvm()()(m1-common)
// FILE: jvm.kt
@Ann(0.1 + 0.1 + 0.1)
actual fun <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>floatNumbersComparison<!>() {}
@@ -0,0 +1,35 @@
// FIR_IDENTICAL
// WITH_STDLIB
// MODULE: m1-common
// FILE: common.kt
import kotlin.reflect.KClass
annotation class Ann(val clazz: KClass<*>)
@Ann(LinkToExpectInnerClass.Inner::class)
expect class LinkToExpectInnerClass {
object Inner
}
expect class WillBeTypealiased
@Ann(WillBeTypealiased::class)
expect fun linkToExpectClassWhichWillBeTypealiased()
@Ann(WillBeTypealiased::class)
expect fun linkToExpectClassWhichWillBeTypealiased2()
// MODULE: m1-jvm()()(m1-common)
// FILE: jvm.kt
@Ann(LinkToExpectInnerClass.Inner::class)
actual class LinkToExpectInnerClass {
actual object Inner
}
actual typealias WillBeTypealiased = Any
@Ann(WillBeTypealiased::class)
actual fun linkToExpectClassWhichWillBeTypealiased() {}
@Ann(Any::class)
actual fun linkToExpectClassWhichWillBeTypealiased2() {}
@@ -0,0 +1,29 @@
// FIR_IDENTICAL
// WITH_STDLIB
// MODULE: m1-common
// FILE: common.kt
@Retention(AnnotationRetention.RUNTIME)
expect annotation class JavaTypealiasAnnotationAnalogue
@Retention(AnnotationRetention.RUNTIME)
expect annotation class JavaTypealiasKotlinAnnotation
// MODULE: m1-jvm()()(m1-common)
// FILE: jvm.kt
actual typealias JavaTypealiasAnnotationAnalogue = JavaTypealiasAnnotationAnalogueImpl
actual typealias JavaTypealiasKotlinAnnotation = JavaTypealiasKotlinAnnotationImpl
// FILE: jvmJavaImpls.java
import kotlin.annotation.AnnotationRetention;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@Retention(RetentionPolicy.RUNTIME)
public @interface JavaTypealiasAnnotationAnalogueImpl {
}
@kotlin.annotation.Retention(AnnotationRetention.RUNTIME)
public @interface JavaTypealiasKotlinAnnotationImpl {
}
@@ -0,0 +1,23 @@
// FIR_IDENTICAL
// WITH_STDLIB
// MODULE: m1-common
// FILE: common.kt
@Target(AnnotationTarget.TYPEALIAS, AnnotationTarget.CLASS)
annotation class Ann
@Ann
expect class KtTypealiasNotMatch
@Ann
expect class AnnotationsNotConsideredOnTypealias
// MODULE: m1-jvm()()(m1-common)
// FILE: jvm.kt
class KtTypealiasNotMatchImpl
actual typealias <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>KtTypealiasNotMatch<!> = KtTypealiasNotMatchImpl
class AnnotationsNotConsideredOnTypealiasImpl
@Ann
actual typealias <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>AnnotationsNotConsideredOnTypealias<!> = AnnotationsNotConsideredOnTypealiasImpl
@@ -0,0 +1,14 @@
// WITH_STDLIB
// MODULE: m1-common
// FILE: common.kt
@Retention(AnnotationRetention.SOURCE)
expect annotation class MyDeprecatedNotMatch
@Retention(AnnotationRetention.RUNTIME)
expect annotation class MyDeprecatedMatch
// MODULE: m1-jvm()()(m1-common)
// FILE: jvm.kt
actual typealias MyDeprecatedNotMatch = java.lang.Deprecated
actual typealias MyDeprecatedMatch = java.lang.Deprecated
@@ -0,0 +1,14 @@
// WITH_STDLIB
// MODULE: m1-common
// FILE: common.kt
@Retention(AnnotationRetention.SOURCE)
expect annotation class MyDeprecatedNotMatch
@Retention(AnnotationRetention.RUNTIME)
expect annotation class MyDeprecatedMatch
// MODULE: m1-jvm()()(m1-common)
// FILE: jvm.kt
actual typealias <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>MyDeprecatedNotMatch<!> = java.lang.Deprecated
actual typealias MyDeprecatedMatch = java.lang.Deprecated
@@ -0,0 +1,32 @@
// WITH_STDLIB
// MODULE: m1-common
// FILE: common.kt
@Target(
AnnotationTarget.CLASS,
AnnotationTarget.FUNCTION,
AnnotationTarget.PROPERTY,
AnnotationTarget.ANNOTATION_CLASS,
AnnotationTarget.CONSTRUCTOR,
AnnotationTarget.PROPERTY_SETTER,
AnnotationTarget.PROPERTY_GETTER,
// removed target TYPEALIAS
)
expect annotation class MyDeprecatedNotMatch
@Target(
AnnotationTarget.CLASS,
AnnotationTarget.FUNCTION,
AnnotationTarget.PROPERTY,
AnnotationTarget.ANNOTATION_CLASS,
AnnotationTarget.CONSTRUCTOR,
AnnotationTarget.PROPERTY_SETTER,
AnnotationTarget.PROPERTY_GETTER,
AnnotationTarget.TYPEALIAS
)
expect annotation class MyDeprecatedMatch
// MODULE: m1-jvm()()(m1-common)
// FILE: jvm.kt
actual typealias MyDeprecatedNotMatch = kotlin.Deprecated
actual typealias MyDeprecatedMatch = kotlin.Deprecated
@@ -0,0 +1,32 @@
// WITH_STDLIB
// MODULE: m1-common
// FILE: common.kt
@Target(
AnnotationTarget.CLASS,
AnnotationTarget.FUNCTION,
AnnotationTarget.PROPERTY,
AnnotationTarget.ANNOTATION_CLASS,
AnnotationTarget.CONSTRUCTOR,
AnnotationTarget.PROPERTY_SETTER,
AnnotationTarget.PROPERTY_GETTER,
// removed target TYPEALIAS
)
expect annotation class MyDeprecatedNotMatch
@Target(
AnnotationTarget.CLASS,
AnnotationTarget.FUNCTION,
AnnotationTarget.PROPERTY,
AnnotationTarget.ANNOTATION_CLASS,
AnnotationTarget.CONSTRUCTOR,
AnnotationTarget.PROPERTY_SETTER,
AnnotationTarget.PROPERTY_GETTER,
AnnotationTarget.TYPEALIAS
)
expect annotation class MyDeprecatedMatch
// MODULE: m1-jvm()()(m1-common)
// FILE: jvm.kt
actual typealias <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>MyDeprecatedNotMatch<!> = kotlin.Deprecated
actual typealias MyDeprecatedMatch = kotlin.Deprecated
@@ -0,0 +1,19 @@
// MODULE: m1-common
// FILE: common.kt
annotation class Ann
<!INCOMPATIBLE_MATCHING{JVM}!>@Ann
expect inline fun hasWeakIncompatibility()<!>
<!INCOMPATIBLE_MATCHING{JVM}, INCOMPATIBLE_MATCHING{JVM}!>@Ann
expect fun hasStrongIncompatibility(arg: Int)<!>
expect fun hasStrongIncompatibility(arg: Double)
// MODULE: m1-jvm()()(m1-common)
// FILE: jvm.kt
actual fun <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT, ACTUAL_WITHOUT_EXPECT!>hasWeakIncompatibility<!>() {}
actual fun <!ACTUAL_WITHOUT_EXPECT!>hasStrongIncompatibility<!>(arg: Any?) {}
actual fun hasStrongIncompatibility(arg: Double) {}
@@ -0,0 +1,19 @@
// MODULE: m1-common
// FILE: common.kt
annotation class Ann
@Ann
expect inline fun hasWeakIncompatibility()
@Ann
expect fun hasStrongIncompatibility<!NO_ACTUAL_FOR_EXPECT{JVM}!>(arg: Int)<!>
expect fun hasStrongIncompatibility(arg: Double)
// MODULE: m1-jvm()()(m1-common)
// FILE: jvm.kt
<!ACTUAL_WITHOUT_EXPECT!>actual<!> fun <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>hasWeakIncompatibility<!>() {}
actual fun hasStrongIncompatibility<!ACTUAL_WITHOUT_EXPECT!>(arg: Any?)<!> {}
actual fun hasStrongIncompatibility(arg: Double) {}
@@ -1,12 +1,13 @@
// WITH_STDLIB
// MODULE: m1-common
// FILE: common.kt
@file:OptIn(ExperimentalMultiplatform::class)
expect annotation class ActualOnly
@RequiresOptIn
<!EXPECT_ACTUAL_OPT_IN_ANNOTATION!>expect<!> annotation class Both
@OptIn(ExperimentalMultiplatform::class)
@RequiresOptIn
@OptionalExpectation
expect annotation class MyOptIn
@@ -1,12 +1,13 @@
// WITH_STDLIB
// MODULE: m1-common
// FILE: common.kt
@file:OptIn(ExperimentalMultiplatform::class)
expect annotation class ActualOnly
@RequiresOptIn
<!EXPECT_ACTUAL_OPT_IN_ANNOTATION{JVM}!>expect<!> annotation class Both
@OptIn(ExperimentalMultiplatform::class)
@RequiresOptIn
@OptionalExpectation
expect annotation class MyOptIn