提交 4520e02b 编写于 作者: A Alexander Udalov

Support fun interfaces in kotlinx-metadata

 #KT-37421 Fixed
上级 c805274d
public abstract interface F : R|kotlin/Any| {
public abstract fun R|kotlin/String|.f(x: R|kotlin/Int|): R|kotlin/Unit|
}
......@@ -604,6 +604,11 @@ public class FirLoadCompiledKotlinGenerated extends AbstractFirLoadCompiledKotli
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")
public void testInheritClassSimple() throws Exception {
runTest("compiler/testData/loadJava/compiledKotlin/class/InheritClassSimple.kt");
......
package test
fun interface F {
fun String.f(x: Int)
}
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");
}
@TestMetadata("FunInterface.kt")
public void testFunInterface() throws Exception {
runTest("compiler/testData/loadJava/compiledKotlin/class/FunInterface.kt");
}
@TestMetadata("InheritClassSimple.kt")
public void testInheritClassSimple() throws Exception {
runTest("compiler/testData/loadJava/compiledKotlin/class/InheritClassSimple.kt");
......
......@@ -604,6 +604,11 @@ public class LoadKotlinWithTypeTableTestGenerated extends AbstractLoadKotlinWith
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")
public void testInheritClassSimple() throws Exception {
runTest("compiler/testData/loadJava/compiledKotlin/class/InheritClassSimple.kt");
......
......@@ -2296,6 +2296,11 @@ public class IrLoadJavaTestGenerated extends AbstractIrLoadJavaTest {
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")
public void testInheritClassSimple() throws Exception {
runTest("compiler/testData/loadJava/compiledKotlin/class/InheritClassSimple.kt");
......
......@@ -2295,6 +2295,11 @@ public class LoadJavaUsingJavacTestGenerated extends AbstractLoadJavaUsingJavacT
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")
public void testInheritClassSimple() throws Exception {
runTest("compiler/testData/loadJava/compiledKotlin/class/InheritClassSimple.kt");
......
......@@ -606,6 +606,11 @@ public class JvmRuntimeDescriptorLoaderTestGenerated extends AbstractJvmRuntimeD
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")
public void testInheritClassSimple() throws Exception {
runTest("compiler/testData/loadJava/compiledKotlin/class/InheritClassSimple.kt");
......
# 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
- [`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
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_EXPECT to "expect",
Flag.Class.IS_INLINE to "inline",
Flag.Class.IS_FUN to "fun",
Flag.Class.IS_CLASS to "class",
Flag.Class.IS_INTERFACE to "interface",
......
......@@ -7,7 +7,7 @@ package org.jetbrains.kotlin.kotlinp.test
import org.jetbrains.kotlin.generators.tests.generator.testGroup
fun main(args: Array<String>) {
fun main() {
System.setProperty("java.awt.headless", "true")
testGroup("libraries/tools/kotlinp/test", "libraries/tools/kotlinp/testData") {
......
......@@ -38,6 +38,11 @@ public class KotlinpTestGenerated extends AbstractKotlinpTest {
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")
public void testLambda() throws Exception {
runTest("libraries/tools/kotlinp/testData/Lambda.kt");
......
fun interface F {
fun String.f(x: Int)
}
// 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 {
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册