Minor. Convert test
This commit is contained in:
+5
-24
@@ -3,44 +3,25 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
// IGNORE_BACKEND_FIR: JVM_IR
|
||||||
// WITH_REFLECT
|
// WITH_REFLECT
|
||||||
// FULL_JDK
|
// FULL_JDK
|
||||||
|
|
||||||
// FILE: A.kt
|
|
||||||
// JVM_TARGET: 1.6
|
|
||||||
|
|
||||||
import java.lang.reflect.AnnotatedType
|
|
||||||
import kotlin.reflect.jvm.javaMethod
|
|
||||||
import kotlin.test.fail
|
|
||||||
|
|
||||||
@Target(AnnotationTarget.TYPE)
|
|
||||||
annotation class TypeAnn
|
|
||||||
|
|
||||||
// FILE: B.kt
|
|
||||||
// JVM_TARGET: 1.8
|
// JVM_TARGET: 1.8
|
||||||
|
|
||||||
import java.lang.reflect.AnnotatedType
|
import java.lang.reflect.AnnotatedType
|
||||||
import kotlin.reflect.jvm.javaMethod
|
import kotlin.reflect.jvm.javaMethod
|
||||||
import kotlin.test.fail
|
import kotlin.test.fail
|
||||||
|
|
||||||
class Kotlin {
|
fun foo(): String.() -> Unit = {}
|
||||||
|
|
||||||
fun foo(s: @TypeAnn String) {
|
|
||||||
}
|
|
||||||
|
|
||||||
fun foo2(): @TypeAnn String {
|
|
||||||
return "OK"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
|
|
||||||
checkTypeAnnotation(
|
checkTypeAnnotation(
|
||||||
Kotlin::foo.javaMethod!!.annotatedParameterTypes.single(),
|
::foo.javaMethod!!.annotatedReturnType,
|
||||||
"class java.lang.String",
|
"kotlin.jvm.functions.Function1<java.lang.String, kotlin.Unit>",
|
||||||
"",
|
"",
|
||||||
"foo"
|
"foo"
|
||||||
)
|
)
|
||||||
|
|
||||||
checkTypeAnnotation(Kotlin::foo2.javaMethod!!.annotatedReturnType, "class java.lang.String", "", "foo2")
|
val typeAnnotation = ::foo.returnType.annotations.single().toString()
|
||||||
|
if (typeAnnotation != "@kotlin.ExtensionFunctionType()") return "can't find type annotations: $typeAnnotation"
|
||||||
|
|
||||||
return "OK"
|
return "OK"
|
||||||
}
|
}
|
||||||
+5
@@ -271,6 +271,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
runTest("compiler/testData/codegen/box/annotations/typeAnnotations/methodParameters.kt");
|
runTest("compiler/testData/codegen/box/annotations/typeAnnotations/methodParameters.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("typeAnnotationTarget6.kt")
|
||||||
|
public void testTypeAnnotationTarget6() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/annotations/typeAnnotations/typeAnnotationTarget6.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("typeUseAnnotation.kt")
|
@TestMetadata("typeUseAnnotation.kt")
|
||||||
public void testTypeUseAnnotation() throws Exception {
|
public void testTypeUseAnnotation() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/annotations/typeAnnotations/typeUseAnnotation.kt");
|
runTest("compiler/testData/codegen/box/annotations/typeAnnotations/typeUseAnnotation.kt");
|
||||||
|
|||||||
-5
@@ -486,10 +486,5 @@ public class CompileKotlinAgainstKotlinTestGenerated extends AbstractCompileKotl
|
|||||||
public void testImplicitReturn() throws Exception {
|
public void testImplicitReturn() throws Exception {
|
||||||
runTest("compiler/testData/compileKotlinAgainstKotlin/typeAnnotations/implicitReturn.kt");
|
runTest("compiler/testData/compileKotlinAgainstKotlin/typeAnnotations/implicitReturn.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("typeAnnotationTarget6.kt")
|
|
||||||
public void testTypeAnnotationTarget6() throws Exception {
|
|
||||||
runTest("compiler/testData/compileKotlinAgainstKotlin/typeAnnotations/typeAnnotationTarget6.kt");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
@@ -271,6 +271,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
runTest("compiler/testData/codegen/box/annotations/typeAnnotations/methodParameters.kt");
|
runTest("compiler/testData/codegen/box/annotations/typeAnnotations/methodParameters.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("typeAnnotationTarget6.kt")
|
||||||
|
public void testTypeAnnotationTarget6() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/annotations/typeAnnotations/typeAnnotationTarget6.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("typeUseAnnotation.kt")
|
@TestMetadata("typeUseAnnotation.kt")
|
||||||
public void testTypeUseAnnotation() throws Exception {
|
public void testTypeUseAnnotation() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/annotations/typeAnnotations/typeUseAnnotation.kt");
|
runTest("compiler/testData/codegen/box/annotations/typeAnnotations/typeUseAnnotation.kt");
|
||||||
|
|||||||
+5
@@ -271,6 +271,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
|||||||
runTest("compiler/testData/codegen/box/annotations/typeAnnotations/methodParameters.kt");
|
runTest("compiler/testData/codegen/box/annotations/typeAnnotations/methodParameters.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("typeAnnotationTarget6.kt")
|
||||||
|
public void testTypeAnnotationTarget6() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/annotations/typeAnnotations/typeAnnotationTarget6.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("typeUseAnnotation.kt")
|
@TestMetadata("typeUseAnnotation.kt")
|
||||||
public void testTypeUseAnnotation() throws Exception {
|
public void testTypeUseAnnotation() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/annotations/typeAnnotations/typeUseAnnotation.kt");
|
runTest("compiler/testData/codegen/box/annotations/typeAnnotations/typeUseAnnotation.kt");
|
||||||
|
|||||||
+5
@@ -271,6 +271,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
runTest("compiler/testData/codegen/box/annotations/typeAnnotations/methodParameters.kt");
|
runTest("compiler/testData/codegen/box/annotations/typeAnnotations/methodParameters.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("typeAnnotationTarget6.kt")
|
||||||
|
public void testTypeAnnotationTarget6() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/annotations/typeAnnotations/typeAnnotationTarget6.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("typeUseAnnotation.kt")
|
@TestMetadata("typeUseAnnotation.kt")
|
||||||
public void testTypeUseAnnotation() throws Exception {
|
public void testTypeUseAnnotation() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/annotations/typeAnnotations/typeUseAnnotation.kt");
|
runTest("compiler/testData/codegen/box/annotations/typeAnnotations/typeUseAnnotation.kt");
|
||||||
|
|||||||
Generated
-5
@@ -481,10 +481,5 @@ public class IrCompileKotlinAgainstKotlinTestGenerated extends AbstractIrCompile
|
|||||||
public void testImplicitReturn() throws Exception {
|
public void testImplicitReturn() throws Exception {
|
||||||
runTest("compiler/testData/compileKotlinAgainstKotlin/typeAnnotations/implicitReturn.kt");
|
runTest("compiler/testData/compileKotlinAgainstKotlin/typeAnnotations/implicitReturn.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("typeAnnotationTarget6.kt")
|
|
||||||
public void testTypeAnnotationTarget6() throws Exception {
|
|
||||||
runTest("compiler/testData/compileKotlinAgainstKotlin/typeAnnotations/typeAnnotationTarget6.kt");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user