From e49b2811ec3c33e8aea2a05d3f93dd3146e45633 Mon Sep 17 00:00:00 2001 From: Mikhail Zarechenskiy Date: Mon, 20 Mar 2017 16:31:02 +0300 Subject: [PATCH] Apply constant folding for collection literals to use in annotations Currently this is achieved with several hacks: - Postpone computation of argument type info when there is no candidate resolver. We have to do this, because we don't have expected type and therefore we could write wrong information to trace - Presume that for annotation calls there is only one candidate resolver and then resolve arguments with expected type (see `getArgumentTypeInfo`), otherwise because of quadratic complexity of the algorithm resolve would be slow --- .../resolve/AnnotationResolverImpl.java | 4 +- .../resolve/calls/ArgumentTypeResolver.java | 16 +++++ .../evaluate/ConstantExpressionEvaluator.kt | 64 +++++++++++++------ .../argumentsOfAnnotation.kt | 28 ++++++++ .../argumentsOfAnnotation.txt | 22 +++++++ .../argumentsOfAnnotationWithKClass.kt | 28 ++++++++ .../argumentsOfAnnotationWithKClass.txt | 32 ++++++++++ .../defaultValuesInAnnotation.kt | 23 +++++++ .../defaultValuesInAnnotation.txt | 41 ++++++++++++ .../defaultValuesWithConstantsInAnnotation.kt | 23 +++++++ ...defaultValuesWithConstantsInAnnotation.txt | 35 ++++++++++ .../checkers/DiagnosticsTestGenerated.java | 24 +++++++ 12 files changed, 321 insertions(+), 19 deletions(-) create mode 100644 compiler/testData/diagnostics/tests/collectionLiterals/argumentsOfAnnotation.kt create mode 100644 compiler/testData/diagnostics/tests/collectionLiterals/argumentsOfAnnotation.txt create mode 100644 compiler/testData/diagnostics/tests/collectionLiterals/argumentsOfAnnotationWithKClass.kt create mode 100644 compiler/testData/diagnostics/tests/collectionLiterals/argumentsOfAnnotationWithKClass.txt create mode 100644 compiler/testData/diagnostics/tests/collectionLiterals/defaultValuesInAnnotation.kt create mode 100644 compiler/testData/diagnostics/tests/collectionLiterals/defaultValuesInAnnotation.txt create mode 100644 compiler/testData/diagnostics/tests/collectionLiterals/defaultValuesWithConstantsInAnnotation.kt create mode 100644 compiler/testData/diagnostics/tests/collectionLiterals/defaultValuesWithConstantsInAnnotation.txt diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/AnnotationResolverImpl.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/AnnotationResolverImpl.java index ccaa65b0bcd..5011d835dd1 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/AnnotationResolverImpl.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/AnnotationResolverImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2010-2015 JetBrains s.r.o. + * Copyright 2010-2017 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,6 +36,8 @@ import org.jetbrains.kotlin.resolve.scopes.LexicalScope; import org.jetbrains.kotlin.storage.StorageManager; import org.jetbrains.kotlin.types.ErrorUtils; import org.jetbrains.kotlin.types.KotlinType; +import org.jetbrains.kotlin.types.TypeUtils; +import org.jetbrains.kotlin.types.expressions.ExpressionTypingContext; import javax.inject.Inject; import java.util.ArrayList; diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/ArgumentTypeResolver.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/ArgumentTypeResolver.java index e8a3288beee..f184b056226 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/ArgumentTypeResolver.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/ArgumentTypeResolver.java @@ -216,6 +216,14 @@ public class ArgumentTypeResolver { return getCallableReferenceTypeInfo(expression, callableReferenceExpression, context, resolveArgumentsMode); } + if (isCollectionLiteralInsideAnnotation(expression, context)) { + // We assume that there is only one candidate resolver for annotation call + // And to resolve collection literal correctly, we need mapping of argument to parameter to get expected type and + // to choose corresponding call (i.e arrayOf/intArrayOf...) + ResolutionContext newContext = context.replaceContextDependency(INDEPENDENT); + return expressionTypingServices.getTypeInfo(expression, newContext); + } + KotlinTypeInfo recordedTypeInfo = getRecordedTypeInfo(expression, context.trace.getBindingContext()); if (recordedTypeInfo != null) { return recordedTypeInfo; @@ -356,6 +364,10 @@ public class ArgumentTypeResolver { KtExpression expression = argument.getArgumentExpression(); if (expression == null) continue; + if (isCollectionLiteralInsideAnnotation(expression, context)) { + continue; + } + CallResolutionContext newContext = context.replaceDataFlowInfo(infoForArguments.getInfo(argument)); // Here we go inside arguments and determine additional data flow information for them KotlinTypeInfo typeInfoForCall = getArgumentTypeInfo(expression, newContext, resolveArgumentsMode); @@ -379,4 +391,8 @@ public class ArgumentTypeResolver { } return null; } + + private static boolean isCollectionLiteralInsideAnnotation(KtExpression expression, CallResolutionContext context) { + return expression instanceof KtCollectionLiteralExpression && context.call.getCallElement() instanceof KtAnnotationEntry; + } } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/constants/evaluate/ConstantExpressionEvaluator.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/constants/evaluate/ConstantExpressionEvaluator.kt index e85a357f1b1..a40eb186a0d 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/constants/evaluate/ConstantExpressionEvaluator.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/constants/evaluate/ConstantExpressionEvaluator.kt @@ -33,6 +33,7 @@ import org.jetbrains.kotlin.name.isSubpackageOf import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.psi.psiUtil.getStrictParentOfType import org.jetbrains.kotlin.resolve.* +import org.jetbrains.kotlin.resolve.BindingContext.COLLECTION_LITERAL_CALL import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall import org.jetbrains.kotlin.resolve.calls.model.ResolvedValueArgument @@ -125,12 +126,10 @@ class ConstantExpressionEvaluator( // array(1, null, 3) - error should be reported on inner expression if (argumentExpression is KtCallExpression) { - val arrayArgument = getArgumentExpressionsForArrayCall(argumentExpression, trace) - if (arrayArgument != null) { - for (expression in arrayArgument.first) { - checkCompileTimeConstant(expression, arrayArgument.second!!, trace) - } - } + getArgumentExpressionsForArrayCall(argumentExpression, trace)?.let { checkArgumentsAreCompileTimeConstants(it, trace) } + } + if (argumentExpression is KtCollectionLiteralExpression) { + getArgumentExpressionsForCollectionLiteralCall(argumentExpression, trace)?.let { checkArgumentsAreCompileTimeConstants(it, trace) } } val constant = ConstantExpressionEvaluator.getConstant(argumentExpression, trace.bindingContext) @@ -164,12 +163,30 @@ class ConstantExpressionEvaluator( } } + private fun checkArgumentsAreCompileTimeConstants(argumentsWithComponentType: Pair, KotlinType?>, trace: BindingTrace) { + val (arguments, componentType) = argumentsWithComponentType + for (expression in arguments) { + checkCompileTimeConstant(expression, componentType!!, trace) + } + } + private fun getArgumentExpressionsForArrayCall( expression: KtCallExpression, trace: BindingTrace ): Pair, KotlinType?>? { - val resolvedCall = expression.getResolvedCall(trace.bindingContext) - if (resolvedCall == null || !CompileTimeConstantUtils.isArrayFunctionCall(resolvedCall)) { + val resolvedCall = expression.getResolvedCall(trace.bindingContext) ?: return null + return getArgumentExpressionsForArrayLikeCall(resolvedCall) + } + + fun getArgumentExpressionsForCollectionLiteralCall( + expression: KtCollectionLiteralExpression, + trace: BindingTrace): Pair, KotlinType?>? { + val resolvedCall = trace[COLLECTION_LITERAL_CALL, expression] ?: return null + return getArgumentExpressionsForArrayLikeCall(resolvedCall) + } + + private fun getArgumentExpressionsForArrayLikeCall(resolvedCall: ResolvedCall<*>): Pair, KotlinType>? { + if (!CompileTimeConstantUtils.isArrayFunctionCall(resolvedCall)) { return null } @@ -448,6 +465,11 @@ private class ConstantExpressionEvaluatorVisitor( } } + override fun visitCollectionLiteralExpression(expression: KtCollectionLiteralExpression, expectedType: KotlinType?): CompileTimeConstant<*>? { + val resolvedCall = trace.bindingContext[COLLECTION_LITERAL_CALL, expression] ?: return null + return createConstantValueForArrayFunctionCall(resolvedCall) + } + private fun evaluateCall(callExpression: KtExpression, receiverExpression: KtExpression, expectedType: KotlinType?): CompileTimeConstant<*>? { val resolvedCall = callExpression.getResolvedCall(trace.bindingContext) ?: return null @@ -673,16 +695,7 @@ private class ConstantExpressionEvaluatorVisitor( // arrayOf() or emptyArray() if (CompileTimeConstantUtils.isArrayFunctionCall(call)) { - val returnType = resultingDescriptor.returnType ?: return null - val componentType = constantExpressionEvaluator.builtIns.getArrayElementType(returnType) - - val arguments = call.valueArguments.values.flatMap { resolveArguments(it.arguments, componentType) } - - return factory.createArrayValue(arguments.map { it.toConstantValue(componentType) }, resultingDescriptor.returnType!!). - wrap( - usesVariableAsConstant = arguments.any { it.usesVariableAsConstant }, - usesNonConstValAsConstant = arguments.any { it.usesNonConstValAsConstant } - ) + return createConstantValueForArrayFunctionCall(call) } // Ann() @@ -701,6 +714,21 @@ private class ConstantExpressionEvaluatorVisitor( return null } + private fun createConstantValueForArrayFunctionCall( + call: ResolvedCall<*> + ): TypedCompileTimeConstant>>? { + val returnType = call.resultingDescriptor.returnType ?: return null + val componentType = constantExpressionEvaluator.builtIns.getArrayElementType(returnType) + + val arguments = call.valueArguments.values.flatMap { resolveArguments(it.arguments, componentType) } + + return factory.createArrayValue(arguments.map { it.toConstantValue(componentType) }, returnType) + .wrap( + usesVariableAsConstant = arguments.any { it.usesVariableAsConstant }, + usesNonConstValAsConstant = arguments.any { it.usesNonConstValAsConstant } + ) + } + override fun visitClassLiteralExpression(expression: KtClassLiteralExpression, expectedType: KotlinType?): CompileTimeConstant<*>? { val jetType = trace.getType(expression)!! if (jetType.isError) return null diff --git a/compiler/testData/diagnostics/tests/collectionLiterals/argumentsOfAnnotation.kt b/compiler/testData/diagnostics/tests/collectionLiterals/argumentsOfAnnotation.kt new file mode 100644 index 00000000000..195748831bf --- /dev/null +++ b/compiler/testData/diagnostics/tests/collectionLiterals/argumentsOfAnnotation.kt @@ -0,0 +1,28 @@ +annotation class Foo(val a: IntArray, val b: Array, val c: FloatArray) + +@Foo([1], ["/"], [1f]) +fun test1() {} + +@Foo([], [], []) +fun test2() {} + +@Foo([1f], [' '], [1]) +fun test3() {} + +@Foo(c = [1f], b = [""], a = [1]) +fun test4() {} + +@Foo([1 + 2], ["Hello, " + "Kotlin"], [1 / 0f]) +fun test5() {} + +const val ONE = 1 +val two = 2 + +@Foo([ONE], [], []) +fun test6() {} + +@Foo([ONE + two], [], []) +fun test7() {} + +@Foo([two], [], []) +fun test8() {} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/collectionLiterals/argumentsOfAnnotation.txt b/compiler/testData/diagnostics/tests/collectionLiterals/argumentsOfAnnotation.txt new file mode 100644 index 00000000000..8046ad6784f --- /dev/null +++ b/compiler/testData/diagnostics/tests/collectionLiterals/argumentsOfAnnotation.txt @@ -0,0 +1,22 @@ +package + +public const val ONE: kotlin.Int = 1 +public val two: kotlin.Int = 2 +@Foo(a = {1}, b = {"/"}, c = {1.0.toFloat()}) public fun test1(): kotlin.Unit +@Foo(a = {}, b = {}, c = {}) public fun test2(): kotlin.Unit +@Foo public fun test3(): kotlin.Unit +@Foo(a = {1}, b = {""}, c = {1.0.toFloat()}) public fun test4(): kotlin.Unit +@Foo(a = {3}, b = {"Hello, Kotlin"}, c = {Infinity.toFloat()}) public fun test5(): kotlin.Unit +@Foo(a = {1}, b = {}, c = {}) public fun test6(): kotlin.Unit +@Foo(a = {3}, b = {}, c = {}) public fun test7(): kotlin.Unit +@Foo(a = {2}, b = {}, c = {}) public fun test8(): kotlin.Unit + +public final annotation class Foo : kotlin.Annotation { + public constructor Foo(/*0*/ a: kotlin.IntArray, /*1*/ b: kotlin.Array, /*2*/ c: kotlin.FloatArray) + public final val a: kotlin.IntArray + public final val b: kotlin.Array + public final val c: kotlin.FloatArray + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/compiler/testData/diagnostics/tests/collectionLiterals/argumentsOfAnnotationWithKClass.kt b/compiler/testData/diagnostics/tests/collectionLiterals/argumentsOfAnnotationWithKClass.kt new file mode 100644 index 00000000000..1d9c0f2b10e --- /dev/null +++ b/compiler/testData/diagnostics/tests/collectionLiterals/argumentsOfAnnotationWithKClass.kt @@ -0,0 +1,28 @@ +import kotlin.reflect.KClass + +annotation class Foo(val a: Array> = []) + +class Gen + +annotation class Bar(val a: Array> = [Int::class, Array::class, Gen::class]) + +@Foo([]) +fun test1() {} + +@Foo([Int::class, String::class]) +fun test2() {} + +@Foo([Array::class]) +fun test3() {} + +@Foo([Gen::class]) +fun test4() {} + +@Foo([""]) +fun test5() {} + +@Foo([Int::class, 1]) +fun test6() {} + +@Bar +fun test7() {} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/collectionLiterals/argumentsOfAnnotationWithKClass.txt b/compiler/testData/diagnostics/tests/collectionLiterals/argumentsOfAnnotationWithKClass.txt new file mode 100644 index 00000000000..8194a59e9b2 --- /dev/null +++ b/compiler/testData/diagnostics/tests/collectionLiterals/argumentsOfAnnotationWithKClass.txt @@ -0,0 +1,32 @@ +package + +@Foo(a = {}) public fun test1(): kotlin.Unit +@Foo(a = {kotlin.Int::class, kotlin.String::class}) public fun test2(): kotlin.Unit +@Foo(a = {kotlin.Array<*>::class}) public fun test3(): kotlin.Unit +@Foo(a = {Gen::class}) public fun test4(): kotlin.Unit +@Foo public fun test5(): kotlin.Unit +@Foo public fun test6(): kotlin.Unit +@Bar public fun test7(): kotlin.Unit + +public final annotation class Bar : kotlin.Annotation { + public constructor Bar(/*0*/ a: kotlin.Array> = ...) + public final val a: kotlin.Array> + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final annotation class Foo : kotlin.Annotation { + public constructor Foo(/*0*/ a: kotlin.Array> = ...) + public final val a: kotlin.Array> + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final class Gen { + public constructor Gen() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/compiler/testData/diagnostics/tests/collectionLiterals/defaultValuesInAnnotation.kt b/compiler/testData/diagnostics/tests/collectionLiterals/defaultValuesInAnnotation.kt new file mode 100644 index 00000000000..902039fb0e9 --- /dev/null +++ b/compiler/testData/diagnostics/tests/collectionLiterals/defaultValuesInAnnotation.kt @@ -0,0 +1,23 @@ +annotation class Foo( + val a: Array = ["/"], + val b: Array = [], + val c: Array = ["1", "2"] +) + +annotation class Bar( + val a: Array = [' '], + val b: Array = ["", ''], + val c: Array = [1] +) + +annotation class Base( + val a0: IntArray = [], + val a1: IntArray = [1], + val b1: FloatArray = [1f], + val b0: FloatArray = [] +) + +annotation class Err( + val a: IntArray = [1L], + val b: Array = [1] +) \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/collectionLiterals/defaultValuesInAnnotation.txt b/compiler/testData/diagnostics/tests/collectionLiterals/defaultValuesInAnnotation.txt new file mode 100644 index 00000000000..1af4e96a65d --- /dev/null +++ b/compiler/testData/diagnostics/tests/collectionLiterals/defaultValuesInAnnotation.txt @@ -0,0 +1,41 @@ +package + +public final annotation class Bar : kotlin.Annotation { + public constructor Bar(/*0*/ a: kotlin.Array = ..., /*1*/ b: kotlin.Array = ..., /*2*/ c: kotlin.Array = ...) + public final val a: kotlin.Array + public final val b: kotlin.Array + public final val c: kotlin.Array + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final annotation class Base : kotlin.Annotation { + public constructor Base(/*0*/ a0: kotlin.IntArray = ..., /*1*/ a1: kotlin.IntArray = ..., /*2*/ b1: kotlin.FloatArray = ..., /*3*/ b0: kotlin.FloatArray = ...) + public final val a0: kotlin.IntArray + public final val a1: kotlin.IntArray + public final val b0: kotlin.FloatArray + public final val b1: kotlin.FloatArray + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final annotation class Err : kotlin.Annotation { + public constructor Err(/*0*/ a: kotlin.IntArray = ..., /*1*/ b: kotlin.Array = ...) + public final val a: kotlin.IntArray + public final val b: kotlin.Array + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final annotation class Foo : kotlin.Annotation { + public constructor Foo(/*0*/ a: kotlin.Array = ..., /*1*/ b: kotlin.Array = ..., /*2*/ c: kotlin.Array = ...) + public final val a: kotlin.Array + public final val b: kotlin.Array + public final val c: kotlin.Array + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/compiler/testData/diagnostics/tests/collectionLiterals/defaultValuesWithConstantsInAnnotation.kt b/compiler/testData/diagnostics/tests/collectionLiterals/defaultValuesWithConstantsInAnnotation.kt new file mode 100644 index 00000000000..1f716f54b09 --- /dev/null +++ b/compiler/testData/diagnostics/tests/collectionLiterals/defaultValuesWithConstantsInAnnotation.kt @@ -0,0 +1,23 @@ +const val ONE = 1 + +annotation class Foo( + val a: IntArray = [ONE], + val b: IntArray = [ONE, 2, 3] +) + +val TWO = 2 + +fun getOne() = ONE +fun getTwo() = TWO + +annotation class Bar( + val a: IntArray = [TWO], + val b: IntArray = [1, TWO], + val c: IntArray = [getOne(), getTwo()] +) + +annotation class Baz( + val a: IntArray = [null], + val b: IntArray = [1, null, 2], + val c: IntArray = [this] +) diff --git a/compiler/testData/diagnostics/tests/collectionLiterals/defaultValuesWithConstantsInAnnotation.txt b/compiler/testData/diagnostics/tests/collectionLiterals/defaultValuesWithConstantsInAnnotation.txt new file mode 100644 index 00000000000..ef81b853909 --- /dev/null +++ b/compiler/testData/diagnostics/tests/collectionLiterals/defaultValuesWithConstantsInAnnotation.txt @@ -0,0 +1,35 @@ +package + +public const val ONE: kotlin.Int = 1 +public val TWO: kotlin.Int = 2 +public fun getOne(): kotlin.Int +public fun getTwo(): kotlin.Int + +public final annotation class Bar : kotlin.Annotation { + public constructor Bar(/*0*/ a: kotlin.IntArray = ..., /*1*/ b: kotlin.IntArray = ..., /*2*/ c: kotlin.IntArray = ...) + public final val a: kotlin.IntArray + public final val b: kotlin.IntArray + public final val c: kotlin.IntArray + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final annotation class Baz : kotlin.Annotation { + public constructor Baz(/*0*/ a: kotlin.IntArray = ..., /*1*/ b: kotlin.IntArray = ..., /*2*/ c: kotlin.IntArray = ...) + public final val a: kotlin.IntArray + public final val b: kotlin.IntArray + public final val c: kotlin.IntArray + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final annotation class Foo : kotlin.Annotation { + public constructor Foo(/*0*/ a: kotlin.IntArray = ..., /*1*/ b: kotlin.IntArray = ...) + public final val a: kotlin.IntArray + public final val b: kotlin.IntArray + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java index 2f2f0e50151..bfc18d229cc 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java @@ -3340,6 +3340,18 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest { KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/collectionLiterals"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); } + @TestMetadata("argumentsOfAnnotation.kt") + public void testArgumentsOfAnnotation() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/collectionLiterals/argumentsOfAnnotation.kt"); + doTest(fileName); + } + + @TestMetadata("argumentsOfAnnotationWithKClass.kt") + public void testArgumentsOfAnnotationWithKClass() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/collectionLiterals/argumentsOfAnnotationWithKClass.kt"); + doTest(fileName); + } + @TestMetadata("basicCollectionLiterals.kt") public void testBasicCollectionLiterals() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/collectionLiterals/basicCollectionLiterals.kt"); @@ -3351,6 +3363,18 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/collectionLiterals/collectionLiteralsAsPrimitiveArrays.kt"); doTest(fileName); } + + @TestMetadata("defaultValuesInAnnotation.kt") + public void testDefaultValuesInAnnotation() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/collectionLiterals/defaultValuesInAnnotation.kt"); + doTest(fileName); + } + + @TestMetadata("defaultValuesWithConstantsInAnnotation.kt") + public void testDefaultValuesWithConstantsInAnnotation() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/collectionLiterals/defaultValuesWithConstantsInAnnotation.kt"); + doTest(fileName); + } } @TestMetadata("compiler/testData/diagnostics/tests/constructorConsistency")