From 52ac8d788d8051781f4e028f35155832a7f21886 Mon Sep 17 00:00:00 2001 From: Mikhael Bogdanov Date: Thu, 9 Jan 2020 12:15:08 +0100 Subject: [PATCH] Minor. Convert test --- .../typeAnnotations/typeAnnotationTarget6.kt | 29 ++++--------------- .../codegen/BlackBoxCodegenTestGenerated.java | 5 ++++ ...mpileKotlinAgainstKotlinTestGenerated.java | 5 ---- .../LightAnalysisModeTestGenerated.java | 5 ++++ .../ir/FirBlackBoxCodegenTestGenerated.java | 5 ++++ .../ir/IrBlackBoxCodegenTestGenerated.java | 5 ++++ ...mpileKotlinAgainstKotlinTestGenerated.java | 5 ---- 7 files changed, 25 insertions(+), 34 deletions(-) rename compiler/testData/{compileKotlinAgainstKotlin => codegen/box/annotations}/typeAnnotations/typeAnnotationTarget6.kt (59%) diff --git a/compiler/testData/compileKotlinAgainstKotlin/typeAnnotations/typeAnnotationTarget6.kt b/compiler/testData/codegen/box/annotations/typeAnnotations/typeAnnotationTarget6.kt similarity index 59% rename from compiler/testData/compileKotlinAgainstKotlin/typeAnnotations/typeAnnotationTarget6.kt rename to compiler/testData/codegen/box/annotations/typeAnnotations/typeAnnotationTarget6.kt index d6a36726ff0..210ecc47e38 100644 --- a/compiler/testData/compileKotlinAgainstKotlin/typeAnnotations/typeAnnotationTarget6.kt +++ b/compiler/testData/codegen/box/annotations/typeAnnotations/typeAnnotationTarget6.kt @@ -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", "", "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" } diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index c9a263cc156..b8f48ce24b4 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -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"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java index 6f8fae51505..04b22616153 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java @@ -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"); - } } } diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 6ae47a56ec1..8d76f9d39d9 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -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"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index aec8c911c5e..a2569abb42f 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -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"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 9a19e9905e2..891c051249e 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -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"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstKotlinTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstKotlinTestGenerated.java index bacc25b349e..fa6ea40076b 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstKotlinTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstKotlinTestGenerated.java @@ -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"); - } } }