[K2, MPP] Support actualization of enums and annotations that have primary constructor with arguments

^KT-57241 Fixed
This commit is contained in:
Ivan Kochurkin
2023-03-09 22:04:54 +01:00
committed by Space Team
parent 44807b7bd4
commit 60edf1def3
7 changed files with 8 additions and 57 deletions
@@ -171,7 +171,7 @@ private class MemberLinksCollector(
declaration.getter?.symbol?.let { expectActualMap[it] = actualProperty.getter!!.symbol } declaration.getter?.symbol?.let { expectActualMap[it] = actualProperty.getter!!.symbol }
declaration.setter?.symbol?.let { expectActualMap[it] = actualProperty.setter!!.symbol } declaration.setter?.symbol?.let { expectActualMap[it] = actualProperty.setter!!.symbol }
} }
} else if (!declaration.parent.containsOptionalExpectation()) { } else if (!declaration.parent.containsOptionalExpectation() && !(declaration is IrConstructor && declaration.isPrimary)) {
diagnosticsReporter.reportMissingActual(declaration) diagnosticsReporter.reportMissingActual(declaration)
} }
} }
@@ -1,34 +0,0 @@
// MODULE: m1-common
// FILE: common.kt
<!NO_ACTUAL_FOR_EXPECT{JVM}!>expect enum class Foo {
ENTRY
}<!>
expect enum class _TimeUnit
// MODULE: m2-jvm()()(m1-common)
// FILE: jvm.kt
actual typealias Foo = FooImpl
actual typealias _TimeUnit = java.util.concurrent.TimeUnit
// FILE: FooImpl.java
public enum FooImpl {
ENTRY("OK") {
@Override
public String getResult() {
return value;
}
};
protected final String value;
public FooImpl(String value) {
this.value = value;
}
public abstract String getResult();
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// MODULE: m1-common // MODULE: m1-common
// FILE: common.kt // FILE: common.kt
@@ -1,17 +0,0 @@
// MODULE: m1-common
// FILE: common.kt
<!NO_ACTUAL_FOR_EXPECT{JVM}!>expect enum class Foo {
ENTRY1,
ENTRY2,
ENTRY3;
}<!>
// MODULE: m2-jvm()()(m1-common)
// FILE: jvm.kt
actual enum class Foo(val x: String) {
ENTRY1("1"),
ENTRY2("2"),
ENTRY3("3");
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// MODULE: m1-common // MODULE: m1-common
// FILE: common.kt // FILE: common.kt
@@ -6,8 +6,8 @@ expect annotation class Foo2
expect annotation class Foo3 expect annotation class Foo3
expect annotation class Foo4 expect annotation class Foo4
expect annotation class Foo5() expect annotation class Foo5()
expect annotation class Foo6<!NO_ACTUAL_FOR_EXPECT{JVM}!>()<!> expect annotation class Foo6()
expect annotation class Foo7<!NO_ACTUAL_FOR_EXPECT{JVM}!>()<!> expect annotation class Foo7()
@<!UNRESOLVED_REFERENCE!>Foo1<!> @<!UNRESOLVED_REFERENCE!>Foo1<!>
fun foo() {} fun foo() {}
@@ -5,9 +5,9 @@ expect class Foo1
expect class Foo2 expect class Foo2
expect class Foo3 expect class Foo3
expect class Bar1<!NO_ACTUAL_FOR_EXPECT{JVM}!>()<!> expect class Bar1()
expect class Bar2<!NO_ACTUAL_FOR_EXPECT{JVM}!>()<!> expect class Bar2()
expect class Bar3<!NO_ACTUAL_FOR_EXPECT{JVM}!>()<!> expect class Bar3()
expect class Bar4() expect class Bar4()
expect class Bar5() expect class Bar5()
expect class Bar6() expect class Bar6()