Minor. Convert test
This commit is contained in:
+5
-24
@@ -3,44 +3,25 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// WITH_REFLECT
|
||||
// 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
|
||||
|
||||
import java.lang.reflect.AnnotatedType
|
||||
import kotlin.reflect.jvm.javaMethod
|
||||
import kotlin.test.fail
|
||||
|
||||
class Kotlin {
|
||||
|
||||
fun foo(s: @TypeAnn String) {
|
||||
}
|
||||
|
||||
fun foo2(): @TypeAnn String {
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
fun foo(): String.() -> Unit = {}
|
||||
|
||||
fun box(): String {
|
||||
|
||||
checkTypeAnnotation(
|
||||
Kotlin::foo.javaMethod!!.annotatedParameterTypes.single(),
|
||||
"class java.lang.String",
|
||||
::foo.javaMethod!!.annotatedReturnType,
|
||||
"kotlin.jvm.functions.Function1<java.lang.String, kotlin.Unit>",
|
||||
"",
|
||||
"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"
|
||||
}
|
||||
+5
@@ -271,6 +271,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
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")
|
||||
public void testTypeUseAnnotation() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/annotations/typeAnnotations/typeUseAnnotation.kt");
|
||||
|
||||
-5
@@ -486,10 +486,5 @@ public class CompileKotlinAgainstKotlinTestGenerated extends AbstractCompileKotl
|
||||
public void testImplicitReturn() throws Exception {
|
||||
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");
|
||||
}
|
||||
|
||||
@TestMetadata("typeAnnotationTarget6.kt")
|
||||
public void testTypeAnnotationTarget6() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/annotations/typeAnnotations/typeAnnotationTarget6.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeUseAnnotation.kt")
|
||||
public void testTypeUseAnnotation() throws Exception {
|
||||
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");
|
||||
}
|
||||
|
||||
@TestMetadata("typeAnnotationTarget6.kt")
|
||||
public void testTypeAnnotationTarget6() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/annotations/typeAnnotations/typeAnnotationTarget6.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeUseAnnotation.kt")
|
||||
public void testTypeUseAnnotation() throws Exception {
|
||||
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");
|
||||
}
|
||||
|
||||
@TestMetadata("typeAnnotationTarget6.kt")
|
||||
public void testTypeAnnotationTarget6() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/annotations/typeAnnotations/typeAnnotationTarget6.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeUseAnnotation.kt")
|
||||
public void testTypeUseAnnotation() throws Exception {
|
||||
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 {
|
||||
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