Support fun interfaces in kotlinx-metadata
#KT-37421 Fixed
This commit is contained in:
+4
@@ -0,0 +1,4 @@
|
|||||||
|
public abstract interface F : R|kotlin/Any| {
|
||||||
|
public abstract fun R|kotlin/String|.f(x: R|kotlin/Int|): R|kotlin/Unit|
|
||||||
|
|
||||||
|
}
|
||||||
Generated
+5
@@ -604,6 +604,11 @@ public class FirLoadCompiledKotlinGenerated extends AbstractFirLoadCompiledKotli
|
|||||||
runTest("compiler/testData/loadJava/compiledKotlin/class/EnumWithPrimitiveConstructorParameter.kt");
|
runTest("compiler/testData/loadJava/compiledKotlin/class/EnumWithPrimitiveConstructorParameter.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("FunInterface.kt")
|
||||||
|
public void testFunInterface() throws Exception {
|
||||||
|
runTest("compiler/testData/loadJava/compiledKotlin/class/FunInterface.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("InheritClassSimple.kt")
|
@TestMetadata("InheritClassSimple.kt")
|
||||||
public void testInheritClassSimple() throws Exception {
|
public void testInheritClassSimple() throws Exception {
|
||||||
runTest("compiler/testData/loadJava/compiledKotlin/class/InheritClassSimple.kt");
|
runTest("compiler/testData/loadJava/compiledKotlin/class/InheritClassSimple.kt");
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
fun interface F {
|
||||||
|
fun String.f(x: Int)
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
public fun interface F {
|
||||||
|
public abstract fun kotlin.String.f(/*0*/ x: kotlin.Int): kotlin.Unit
|
||||||
|
}
|
||||||
@@ -2295,6 +2295,11 @@ public class LoadJavaTestGenerated extends AbstractLoadJavaTest {
|
|||||||
runTest("compiler/testData/loadJava/compiledKotlin/class/EnumWithPrimitiveConstructorParameter.kt");
|
runTest("compiler/testData/loadJava/compiledKotlin/class/EnumWithPrimitiveConstructorParameter.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("FunInterface.kt")
|
||||||
|
public void testFunInterface() throws Exception {
|
||||||
|
runTest("compiler/testData/loadJava/compiledKotlin/class/FunInterface.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("InheritClassSimple.kt")
|
@TestMetadata("InheritClassSimple.kt")
|
||||||
public void testInheritClassSimple() throws Exception {
|
public void testInheritClassSimple() throws Exception {
|
||||||
runTest("compiler/testData/loadJava/compiledKotlin/class/InheritClassSimple.kt");
|
runTest("compiler/testData/loadJava/compiledKotlin/class/InheritClassSimple.kt");
|
||||||
|
|||||||
Generated
+5
@@ -604,6 +604,11 @@ public class LoadKotlinWithTypeTableTestGenerated extends AbstractLoadKotlinWith
|
|||||||
runTest("compiler/testData/loadJava/compiledKotlin/class/EnumWithPrimitiveConstructorParameter.kt");
|
runTest("compiler/testData/loadJava/compiledKotlin/class/EnumWithPrimitiveConstructorParameter.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("FunInterface.kt")
|
||||||
|
public void testFunInterface() throws Exception {
|
||||||
|
runTest("compiler/testData/loadJava/compiledKotlin/class/FunInterface.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("InheritClassSimple.kt")
|
@TestMetadata("InheritClassSimple.kt")
|
||||||
public void testInheritClassSimple() throws Exception {
|
public void testInheritClassSimple() throws Exception {
|
||||||
runTest("compiler/testData/loadJava/compiledKotlin/class/InheritClassSimple.kt");
|
runTest("compiler/testData/loadJava/compiledKotlin/class/InheritClassSimple.kt");
|
||||||
|
|||||||
+5
@@ -2296,6 +2296,11 @@ public class IrLoadJavaTestGenerated extends AbstractIrLoadJavaTest {
|
|||||||
runTest("compiler/testData/loadJava/compiledKotlin/class/EnumWithPrimitiveConstructorParameter.kt");
|
runTest("compiler/testData/loadJava/compiledKotlin/class/EnumWithPrimitiveConstructorParameter.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("FunInterface.kt")
|
||||||
|
public void testFunInterface() throws Exception {
|
||||||
|
runTest("compiler/testData/loadJava/compiledKotlin/class/FunInterface.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("InheritClassSimple.kt")
|
@TestMetadata("InheritClassSimple.kt")
|
||||||
public void testInheritClassSimple() throws Exception {
|
public void testInheritClassSimple() throws Exception {
|
||||||
runTest("compiler/testData/loadJava/compiledKotlin/class/InheritClassSimple.kt");
|
runTest("compiler/testData/loadJava/compiledKotlin/class/InheritClassSimple.kt");
|
||||||
|
|||||||
Generated
+5
@@ -2295,6 +2295,11 @@ public class LoadJavaUsingJavacTestGenerated extends AbstractLoadJavaUsingJavacT
|
|||||||
runTest("compiler/testData/loadJava/compiledKotlin/class/EnumWithPrimitiveConstructorParameter.kt");
|
runTest("compiler/testData/loadJava/compiledKotlin/class/EnumWithPrimitiveConstructorParameter.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("FunInterface.kt")
|
||||||
|
public void testFunInterface() throws Exception {
|
||||||
|
runTest("compiler/testData/loadJava/compiledKotlin/class/FunInterface.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("InheritClassSimple.kt")
|
@TestMetadata("InheritClassSimple.kt")
|
||||||
public void testInheritClassSimple() throws Exception {
|
public void testInheritClassSimple() throws Exception {
|
||||||
runTest("compiler/testData/loadJava/compiledKotlin/class/InheritClassSimple.kt");
|
runTest("compiler/testData/loadJava/compiledKotlin/class/InheritClassSimple.kt");
|
||||||
|
|||||||
+5
@@ -606,6 +606,11 @@ public class JvmRuntimeDescriptorLoaderTestGenerated extends AbstractJvmRuntimeD
|
|||||||
runTest("compiler/testData/loadJava/compiledKotlin/class/EnumWithPrimitiveConstructorParameter.kt");
|
runTest("compiler/testData/loadJava/compiledKotlin/class/EnumWithPrimitiveConstructorParameter.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("FunInterface.kt")
|
||||||
|
public void testFunInterface() throws Exception {
|
||||||
|
runTest("compiler/testData/loadJava/compiledKotlin/class/FunInterface.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("InheritClassSimple.kt")
|
@TestMetadata("InheritClassSimple.kt")
|
||||||
public void testInheritClassSimple() throws Exception {
|
public void testInheritClassSimple() throws Exception {
|
||||||
runTest("compiler/testData/loadJava/compiledKotlin/class/InheritClassSimple.kt");
|
runTest("compiler/testData/loadJava/compiledKotlin/class/InheritClassSimple.kt");
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
# kotlinx-metadata-jvm
|
# kotlinx-metadata-jvm
|
||||||
|
|
||||||
|
## 0.1.1
|
||||||
|
|
||||||
|
- [`KT-37421`](https://youtrack.jetbrains.com/issue/KT-37421) Add Flag.Class.IS_FUN for functional interfaces
|
||||||
|
- Add `KmModule.optionalAnnotationClasses` for the new scheme of compilation of OptionalExpectation annotations in multiplatform projects ([KT-38652](https://youtrack.jetbrains.com/issue/KT-38652))
|
||||||
|
|
||||||
## 0.1.0
|
## 0.1.0
|
||||||
|
|
||||||
- [`KT-26602`](https://youtrack.jetbrains.com/issue/KT-26602) Provide a value-based API
|
- [`KT-26602`](https://youtrack.jetbrains.com/issue/KT-26602) Provide a value-based API
|
||||||
|
|||||||
@@ -207,6 +207,12 @@ class Flag(private val offset: Int, private val bitWidth: Int, private val value
|
|||||||
*/
|
*/
|
||||||
@JvmField
|
@JvmField
|
||||||
val IS_INLINE = Flag(F.IS_INLINE_CLASS)
|
val IS_INLINE = Flag(F.IS_INLINE_CLASS)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Signifies that the corresponding class is a functional interface, i.e. marked with the keyword `fun`.
|
||||||
|
*/
|
||||||
|
@JvmField
|
||||||
|
val IS_FUN = Flag(F.IS_FUN_INTERFACE)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -946,6 +946,7 @@ private val CLASS_FLAGS_MAP = COMMON_FLAGS_MAP + mapOf(
|
|||||||
Flag.Class.IS_EXTERNAL to "external",
|
Flag.Class.IS_EXTERNAL to "external",
|
||||||
Flag.Class.IS_EXPECT to "expect",
|
Flag.Class.IS_EXPECT to "expect",
|
||||||
Flag.Class.IS_INLINE to "inline",
|
Flag.Class.IS_INLINE to "inline",
|
||||||
|
Flag.Class.IS_FUN to "fun",
|
||||||
|
|
||||||
Flag.Class.IS_CLASS to "class",
|
Flag.Class.IS_CLASS to "class",
|
||||||
Flag.Class.IS_INTERFACE to "interface",
|
Flag.Class.IS_INTERFACE to "interface",
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@ package org.jetbrains.kotlin.kotlinp.test
|
|||||||
|
|
||||||
import org.jetbrains.kotlin.generators.tests.generator.testGroup
|
import org.jetbrains.kotlin.generators.tests.generator.testGroup
|
||||||
|
|
||||||
fun main(args: Array<String>) {
|
fun main() {
|
||||||
System.setProperty("java.awt.headless", "true")
|
System.setProperty("java.awt.headless", "true")
|
||||||
|
|
||||||
testGroup("libraries/tools/kotlinp/test", "libraries/tools/kotlinp/testData") {
|
testGroup("libraries/tools/kotlinp/test", "libraries/tools/kotlinp/testData") {
|
||||||
|
|||||||
+5
@@ -38,6 +38,11 @@ public class KotlinpTestGenerated extends AbstractKotlinpTest {
|
|||||||
runTest("libraries/tools/kotlinp/testData/Contracts.kt");
|
runTest("libraries/tools/kotlinp/testData/Contracts.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("FunInterface.kt")
|
||||||
|
public void testFunInterface() throws Exception {
|
||||||
|
runTest("libraries/tools/kotlinp/testData/FunInterface.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("Lambda.kt")
|
@TestMetadata("Lambda.kt")
|
||||||
public void testLambda() throws Exception {
|
public void testLambda() throws Exception {
|
||||||
runTest("libraries/tools/kotlinp/testData/Lambda.kt");
|
runTest("libraries/tools/kotlinp/testData/Lambda.kt");
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fun interface F {
|
||||||
|
fun String.f(x: Int)
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
// F.class
|
||||||
|
// ------------------------------------------
|
||||||
|
public abstract fun interface F : kotlin/Any {
|
||||||
|
|
||||||
|
// signature: f(Ljava/lang/String;I)V
|
||||||
|
public abstract fun kotlin/String.f(x: kotlin/Int): kotlin/Unit
|
||||||
|
|
||||||
|
// module name: test-module
|
||||||
|
}
|
||||||
|
// META-INF/test-module.kotlin_module
|
||||||
|
// ------------------------------------------
|
||||||
|
module {
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user