Allow assigning array to vararg in named form in annotations

See more in KT-20171
This commit is contained in:
Mikhail Zarechenskiy
2017-09-13 16:05:46 +03:00
parent f905d56b38
commit 68259f7939
26 changed files with 410 additions and 96 deletions
@@ -620,6 +620,8 @@ public interface Errors {
DiagnosticFactory1<KtExpression, KotlinType> MISSING_RECEIVER = DiagnosticFactory1.create(ERROR);
DiagnosticFactory0<KtExpression> NO_RECEIVER_ALLOWED = DiagnosticFactory0.create(ERROR);
DiagnosticFactory0<KtExpression> ASSIGNING_SINGLE_ELEMENT_TO_VARARG_IN_NAMED_FORM = DiagnosticFactory0.create(WARNING);
// Call resolution
DiagnosticFactory0<KtExpression> ILLEGAL_SELECTOR = DiagnosticFactory0.create(ERROR);
@@ -55,7 +55,7 @@ fun ResolutionContext<*>.reportTypeMismatchDueToTypeProjection(
is CallPosition.ValueArgumentPosition -> Pair(
callPosition.resolvedCall, {
f: CallableDescriptor ->
getEffectiveExpectedType(f.valueParameters[callPosition.valueParameter.index], callPosition.valueArgument)
getEffectiveExpectedType(f.valueParameters[callPosition.valueParameter.index], callPosition.valueArgument, this)
})
is CallPosition.ExtensionReceiverPosition -> Pair(
callPosition.resolvedCall, {
@@ -756,6 +756,7 @@ public class DefaultErrorMessages {
MAP.put(NO_VALUE_FOR_PARAMETER, "No value passed for parameter ''{0}''", NAME);
MAP.put(MISSING_RECEIVER, "A receiver of type {0} is required", RENDER_TYPE);
MAP.put(NO_RECEIVER_ALLOWED, "No receiver can be passed to this function or property");
MAP.put(ASSIGNING_SINGLE_ELEMENT_TO_VARARG_IN_NAMED_FORM, "Assigning single elements to varargs in named form is deprecated");
MAP.put(CREATING_AN_INSTANCE_OF_ABSTRACT_CLASS, "Cannot create an instance of an abstract class");
@@ -278,7 +278,7 @@ class CallCompleter(
val argumentMapping = getArgumentMapping(valueArgument!!)
val (expectedType, callPosition) = when (argumentMapping) {
is ArgumentMatch -> Pair(
getEffectiveExpectedType(argumentMapping.valueParameter, valueArgument),
getEffectiveExpectedType(argumentMapping.valueParameter, valueArgument, context),
CallPosition.ValueArgumentPosition(results.resultingCall, argumentMapping.valueParameter, valueArgument))
else -> Pair(TypeUtils.NO_EXPECTED_TYPE, CallPosition.Unknown)
}
@@ -18,16 +18,21 @@ package org.jetbrains.kotlin.resolve.calls.callResolverUtil
import com.google.common.collect.Lists
import com.intellij.util.containers.ContainerUtil
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.builtins.ReflectionTypes
import org.jetbrains.kotlin.builtins.isSuspendFunctionType
import org.jetbrains.kotlin.config.LanguageFeature
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.descriptors.impl.TypeAliasConstructorDescriptor
import org.jetbrains.kotlin.lexer.KtToken
import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.calls.CallTransformer
import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
import org.jetbrains.kotlin.resolve.calls.callUtil.getValueArgumentForExpression
import org.jetbrains.kotlin.resolve.calls.components.isVararg
import org.jetbrains.kotlin.resolve.calls.context.ResolutionContext
import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystem
import org.jetbrains.kotlin.resolve.calls.inference.constraintPosition.ConstraintPositionKind.EXPECTED_TYPE_POSITION
import org.jetbrains.kotlin.resolve.calls.inference.getNestedTypeVariables
@@ -45,6 +50,7 @@ import org.jetbrains.kotlin.types.TypeUtils.DONT_CARE
import org.jetbrains.kotlin.types.checker.KotlinTypeChecker
import org.jetbrains.kotlin.types.expressions.OperatorConventions
import org.jetbrains.kotlin.types.typeUtil.contains
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
enum class ResolveArgumentsMode {
RESOLVE_FUNCTION_ARGUMENTS,
@@ -177,8 +183,12 @@ fun getSuperCallExpression(call: Call): KtSuperExpression? {
return (call.explicitReceiver as? ExpressionReceiver)?.expression as? KtSuperExpression
}
fun getEffectiveExpectedType(parameterDescriptor: ValueParameterDescriptor, argument: ValueArgument): KotlinType {
if (argument.getSpreadElement() != null) {
fun getEffectiveExpectedType(
parameterDescriptor: ValueParameterDescriptor,
argument: ValueArgument,
context: ResolutionContext<*>
): KotlinType {
if (argument.getSpreadElement() != null || shouldCheckAsArray(parameterDescriptor, argument, context)) {
if (parameterDescriptor.varargElementType == null) {
// Spread argument passed to a non-vararg parameter, an error is already reported by ValueArgumentsToParametersMapper
return DONT_CARE
@@ -193,6 +203,31 @@ fun getEffectiveExpectedType(parameterDescriptor: ValueParameterDescriptor, argu
return parameterDescriptor.type
}
private fun shouldCheckAsArray(
parameterDescriptor: ValueParameterDescriptor,
argument: ValueArgument,
context: ResolutionContext<*>
): Boolean {
if (!context.languageVersionSettings.supportsFeature(LanguageFeature.AssigningArraysToVarargsInNamedFormInAnnotations)) return false
if (!isParameterOfAnnotation(parameterDescriptor)) return false
return argument.isNamed() && parameterDescriptor.isVararg && isArrayOrArrayLiteral(argument, context)
}
fun isParameterOfAnnotation(parameterDescriptor: ValueParameterDescriptor): Boolean {
val constructedClass = parameterDescriptor.containingDeclaration.safeAs<ConstructorDescriptor>()?.constructedClass
return DescriptorUtils.isAnnotationClass(constructedClass)
}
fun isArrayOrArrayLiteral(argument: ValueArgument, context: ResolutionContext<*>): Boolean {
val argumentExpression = argument.getArgumentExpression() ?: return false
if (argumentExpression is KtCollectionLiteralExpression) return true
val type = context.trace.getType(argumentExpression) ?: return false
return KotlinBuiltIns.isArrayOrPrimitiveArray(type)
}
fun createResolutionCandidatesForConstructors(
lexicalScope: LexicalScope,
call: Call,
@@ -363,7 +363,7 @@ class CandidateResolver(
for (argument in resolvedArgument.arguments) {
val expression = argument.getArgumentExpression() ?: continue
val expectedType = getEffectiveExpectedType(parameterDescriptor, argument)
val expectedType = getEffectiveExpectedType(parameterDescriptor, argument, context)
val newContext = context.replaceDataFlowInfo(infoForArguments.getInfo(argument)).replaceExpectedType(expectedType)
val typeInfoForCall = argumentTypeResolver.getArgumentTypeInfo(expression, newContext, resolveFunctionArgumentBodies)
@@ -174,7 +174,7 @@ class GenericCandidateResolver(
context: CallCandidateResolutionContext<*>,
resolveFunctionArgumentBodies: ResolveArgumentsMode
) {
val effectiveExpectedType = getEffectiveExpectedType(valueParameterDescriptor, valueArgument)
val effectiveExpectedType = getEffectiveExpectedType(valueParameterDescriptor, valueArgument, context)
val argumentExpression = valueArgument.getArgumentExpression()
val expectedType = substitutor.substitute(effectiveExpectedType, Variance.INVARIANT)
@@ -336,7 +336,7 @@ class GenericCandidateResolver(
) {
val argumentExpression = valueArgument.getArgumentExpression() ?: return
val effectiveExpectedType = getEffectiveExpectedType(valueParameterDescriptor, valueArgument)
val effectiveExpectedType = getEffectiveExpectedType(valueParameterDescriptor, valueArgument, context)
if (isCoroutineCallWithAdditionalInference(valueParameterDescriptor, valueArgument)) {
coroutineInferenceSupport.analyzeCoroutine(functionLiteral, valueArgument, constraintSystem, context, effectiveExpectedType)
@@ -398,7 +398,7 @@ class GenericCandidateResolver(
constraintSystem: ConstraintSystem.Builder,
context: CallCandidateResolutionContext<D>
) {
val effectiveExpectedType = getEffectiveExpectedType(valueParameterDescriptor, valueArgument)
val effectiveExpectedType = getEffectiveExpectedType(valueParameterDescriptor, valueArgument, context)
val expectedType = getExpectedTypeForCallableReference(callableReference, constraintSystem, context, effectiveExpectedType)
?: return
if (!ReflectionTypes.isCallableType(expectedType)) return
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2016 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.
@@ -203,7 +203,7 @@ class CoroutineInferenceSupport(
?: return@forceInferenceForArguments
with(NewKotlinTypeChecker) {
val parameterType = getEffectiveExpectedType(argumentMatch.valueParameter, valueArgument)
val parameterType = getEffectiveExpectedType(argumentMatch.valueParameter, valueArgument, context)
CoroutineTypeCheckerContext().isSubtypeOf(kotlinType.unwrap(), parameterType.unwrap())
}
}
@@ -176,7 +176,7 @@ class KotlinToResolvedCallTransformer(
val argumentMapping = resolvedCall.getArgumentMapping(valueArgument!!)
val (expectedType, callPosition) = when (argumentMapping) {
is ArgumentMatch -> Pair(
getEffectiveExpectedType(argumentMapping.valueParameter, valueArgument),
getEffectiveExpectedType(argumentMapping.valueParameter, valueArgument, context),
CallPosition.ValueArgumentPosition(resolvedCall, argumentMapping.valueParameter, valueArgument))
else -> Pair(TypeUtils.NO_EXPECTED_TYPE, CallPosition.Unknown)
}
@@ -101,6 +101,8 @@ class ConstantExpressionEvaluator(
val constants = compileTimeConstants.map { it.toConstantValue(constantType) }
if (argumentsAsVararg) {
if (isArrayPassedInNamedForm(constants, resolvedArgument)) return constants.single()
if (parameterDescriptor.declaresDefaultValue() && compileTimeConstants.isEmpty()) return null
return constantValueFactory.createArrayValue(constants, parameterDescriptor.type)
@@ -111,6 +113,12 @@ class ConstantExpressionEvaluator(
}
}
private fun isArrayPassedInNamedForm(constants: List<ConstantValue<Any?>>, resolvedArgument: ResolvedValueArgument): Boolean {
val constant = constants.singleOrNull() ?: return false
val argument = resolvedArgument.arguments.singleOrNull() ?: return false
return KotlinBuiltIns.isArrayOrPrimitiveArray(constant.type) && argument.isNamed()
}
private fun checkCompileTimeConstant(
argumentExpression: KtExpression,
expectedType: KotlinType,
@@ -0,0 +1,68 @@
// LANGUAGE_VERSION: 1.2
// WITH_REFLECT
// IGNORE_BACKEND: JS
// IGNORE_BACKEND: NATIVE
// FILE: JavaAnn.java
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@Retention(RetentionPolicy.RUNTIME)
@interface JavaAnn {
String[] value() default {};
String[] path() default {};
}
// FILE: test.kt
import java.util.Arrays
import kotlin.reflect.KClass
import kotlin.reflect.KFunction0
import kotlin.reflect.full.findAnnotation
inline fun <reified T : Annotation> test(kFunction: KFunction0<Unit>, test: T.() -> Unit) {
val annotation = kFunction.findAnnotation<T>()!!
annotation.test()
}
fun check(b: Boolean, message: String) {
if (!b) throw RuntimeException(message)
}
annotation class Ann(vararg val s: String)
@Ann(s = ["value1", "value2"])
fun test1() {}
@Ann(s = arrayOf("value3", "value4"))
fun test2() {}
@JavaAnn(value = ["value5"], path = ["value6"])
fun test3() {}
@JavaAnn("value7", path = ["value8"])
fun test4() {}
fun box(): String {
test<Ann>(::test1) {
check(s.contentEquals(arrayOf("value1", "value2")), "Fail 1: ${s.joinToString()}")
}
test<Ann>(::test2) {
check(s.contentEquals(arrayOf("value3", "value4")), "Fail 2: ${s.joinToString()}")
}
test<JavaAnn>(::test3) {
check(value.contentEquals(arrayOf("value5")), "Fail 3: ${value.joinToString()}")
check(path.contentEquals(arrayOf("value6")), "Fail 3: ${path.joinToString()}")
}
test<JavaAnn>(::test4) {
check(value.contentEquals(arrayOf("value7")), "Fail 4: ${value.joinToString()}")
check(path.contentEquals(arrayOf("value8")), "Fail 4: ${path.joinToString()}")
}
return "OK"
}
@@ -0,0 +1,45 @@
// !LANGUAGE: +ArrayLiteralsInAnnotations, +AssigningArraysToVarargsInNamedFormInAnnotations
// FILE: JavaAnn.java
@interface JavaAnn {
String[] value() default {};
String[] path() default {};
}
// FILE: test.kt
annotation class Ann(vararg val s: String)
@Ann(s = arrayOf())
fun test1() {}
@Ann(s = <!TYPE_MISMATCH!>intArrayOf()<!>)
fun test2() {}
@Ann(s = <!TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>arrayOf(1)<!>)
fun test3() {}
@Ann("value1", "value2")
fun test4() {}
@Ann(s = ["value"])
fun test5() {}
@JavaAnn(value = arrayOf("value"))
fun jTest1() {}
@JavaAnn(value = ["value"])
fun jTest2() {}
@JavaAnn(value = ["value"], path = ["path"])
fun jTest3() {}
annotation class IntAnn(vararg val i: Int)
@IntAnn(i = [1, 2])
fun foo1() {}
@IntAnn(i = intArrayOf(0))
fun foo2() {}
@@ -0,0 +1,37 @@
package
@IntAnn(i = {1, 2}) public fun foo1(): kotlin.Unit
@IntAnn(i = {0}) public fun foo2(): kotlin.Unit
@JavaAnn(value = {"value"}) public fun jTest1(): kotlin.Unit
@JavaAnn(value = {"value"}) public fun jTest2(): kotlin.Unit
@JavaAnn(path = {"path"}, value = {"value"}) public fun jTest3(): kotlin.Unit
@Ann(s = {}) public fun test1(): kotlin.Unit
@Ann(s = {}) public fun test2(): kotlin.Unit
@Ann(s = {1}) public fun test3(): kotlin.Unit
@Ann(s = {"value1", "value2"}) public fun test4(): kotlin.Unit
@Ann(s = {"value"}) public fun test5(): kotlin.Unit
public final annotation class Ann : kotlin.Annotation {
public constructor Ann(/*0*/ vararg s: kotlin.String /*kotlin.Array<out kotlin.String>*/)
public final val s: kotlin.Array<out kotlin.String>
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 IntAnn : kotlin.Annotation {
public constructor IntAnn(/*0*/ vararg i: kotlin.Int /*kotlin.IntArray*/)
public final val i: 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/*package*/ final annotation class JavaAnn : kotlin.Annotation {
public/*package*/ constructor JavaAnn(/*0*/ vararg value: kotlin.String /*kotlin.Array<out kotlin.String>*/ = ..., /*1*/ path: kotlin.Array<kotlin.String> = ...)
public final val path: kotlin.Array<kotlin.String>
public final val value: kotlin.Array<kotlin.String>
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
}
@@ -0,0 +1,48 @@
// !LANGUAGE: +ArrayLiteralsInAnnotations, -AssigningArraysToVarargsInNamedFormInAnnotations
// FILE: JavaAnn.java
@interface JavaAnn {
String[] value() default {};
String[] path() default {};
}
// FILE: test.kt
annotation class Ann(vararg val s: String)
@Ann(s = <!TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>arrayOf()<!>)
fun test1() {}
@Ann(s = <!TYPE_MISMATCH!>intArrayOf()<!>)
fun test2() {}
@Ann(s = <!TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>arrayOf(1)<!>)
fun test3() {}
@Ann(s = <!TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH, TYPE_MISMATCH!>["value"]<!>)
fun test5() {}
@JavaAnn(value = <!TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>arrayOf("value")<!>)
fun jTest1() {}
@JavaAnn(value = <!TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH, TYPE_MISMATCH!>["value"]<!>)
fun jTest2() {}
@JavaAnn(value = <!TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH, TYPE_MISMATCH!>["value"]<!>, path = ["path"])
fun jTest3() {}
annotation class IntAnn(vararg val i: Int)
@IntAnn(i = <!TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH, TYPE_MISMATCH!>[1, 2]<!>)
fun foo1() {}
@IntAnn(i = <!TYPE_MISMATCH!>intArrayOf(0)<!>)
fun foo2() {}
fun foo(vararg <!UNUSED_PARAMETER!>i<!>: Int) {}
@Ann(s = "value")
fun dep1() {
foo(i = 1)
}
@@ -0,0 +1,38 @@
package
@Ann(s = {"value"}) public fun dep1(): kotlin.Unit
public fun foo(/*0*/ vararg i: kotlin.Int /*kotlin.IntArray*/): kotlin.Unit
@IntAnn(i = {1, 2}) public fun foo1(): kotlin.Unit
@IntAnn(i = {0}) public fun foo2(): kotlin.Unit
@JavaAnn(value = {"value"}) public fun jTest1(): kotlin.Unit
@JavaAnn(value = {"value"}) public fun jTest2(): kotlin.Unit
@JavaAnn(path = {"path"}, value = {"value"}) public fun jTest3(): kotlin.Unit
@Ann(s = {}) public fun test1(): kotlin.Unit
@Ann(s = {}) public fun test2(): kotlin.Unit
@Ann(s = {1}) public fun test3(): kotlin.Unit
@Ann(s = {"value"}) public fun test5(): kotlin.Unit
public final annotation class Ann : kotlin.Annotation {
public constructor Ann(/*0*/ vararg s: kotlin.String /*kotlin.Array<out kotlin.String>*/)
public final val s: kotlin.Array<out kotlin.String>
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 IntAnn : kotlin.Annotation {
public constructor IntAnn(/*0*/ vararg i: kotlin.Int /*kotlin.IntArray*/)
public final val i: 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/*package*/ final annotation class JavaAnn : kotlin.Annotation {
public/*package*/ constructor JavaAnn(/*0*/ vararg value: kotlin.String /*kotlin.Array<out kotlin.String>*/ = ..., /*1*/ path: kotlin.Array<kotlin.String> = ...)
public final val path: kotlin.Array<kotlin.String>
public final val value: kotlin.Array<kotlin.String>
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
}
@@ -19631,6 +19631,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/vararg"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
}
@TestMetadata("assigningArrayToVarargInAnnotation.kt")
public void testAssigningArrayToVarargInAnnotation() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/vararg/assigningArrayToVarargInAnnotation.kt");
doTest(fileName);
}
@TestMetadata("kt1978.kt")
public void testKt1978() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/vararg/kt1978.kt");
@@ -33,7 +33,7 @@ import java.util.regex.Pattern;
@RunWith(JUnit3RunnerWithInners.class)
public class CompilerLightClassTestGenerated extends AbstractCompilerLightClassTest {
public void testAllFilesPresentInLightClasses() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses"), Pattern.compile("^([^.]+)\\.(kt|kts)$"), TargetBackend.ANY, true, "local", "ideRegression");
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true, "local", "ideRegression");
}
@TestMetadata("AnnotationClass.kt")
@@ -161,7 +161,7 @@ public class CompilerLightClassTestGenerated extends AbstractCompilerLightClassT
@RunWith(JUnit3RunnerWithInners.class)
public static class CompilationErrors extends AbstractCompilerLightClassTest {
public void testAllFilesPresentInCompilationErrors() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses/compilationErrors"), Pattern.compile("^([^.]+)\\.(kt|kts)$"), TargetBackend.ANY, true);
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses/compilationErrors"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("AnnotationModifiers.kt")
@@ -212,7 +212,7 @@ public class CompilerLightClassTestGenerated extends AbstractCompilerLightClassT
@RunWith(JUnit3RunnerWithInners.class)
public static class Delegation extends AbstractCompilerLightClassTest {
public void testAllFilesPresentInDelegation() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses/delegation"), Pattern.compile("^([^.]+)\\.(kt|kts)$"), TargetBackend.ANY, true);
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses/delegation"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("Function.kt")
@@ -226,6 +226,12 @@ public class CompilerLightClassTestGenerated extends AbstractCompilerLightClassT
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/delegation/Property.kt");
doTest(fileName);
}
@TestMetadata("WithPlatformTypes.NoCompile.kt")
public void testWithPlatformTypes_NoCompile() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/delegation/WithPlatformTypes.NoCompile.kt");
doTest(fileName);
}
}
@TestMetadata("compiler/testData/asJava/lightClasses/facades")
@@ -233,7 +239,13 @@ public class CompilerLightClassTestGenerated extends AbstractCompilerLightClassT
@RunWith(JUnit3RunnerWithInners.class)
public static class Facades extends AbstractCompilerLightClassTest {
public void testAllFilesPresentInFacades() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses/facades"), Pattern.compile("^([^.]+)\\.(kt|kts)$"), TargetBackend.ANY, true);
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses/facades"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("EmptyFile.NoCompile.kt")
public void testEmptyFile_NoCompile() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/facades/EmptyFile.NoCompile.kt");
doTest(fileName);
}
@TestMetadata("MultiFile.kt")
@@ -260,7 +272,7 @@ public class CompilerLightClassTestGenerated extends AbstractCompilerLightClassT
@RunWith(JUnit3RunnerWithInners.class)
public static class NullabilityAnnotations extends AbstractCompilerLightClassTest {
public void testAllFilesPresentInNullabilityAnnotations() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses/nullabilityAnnotations"), Pattern.compile("^([^.]+)\\.(kt|kts)$"), TargetBackend.ANY, true);
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses/nullabilityAnnotations"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("Class.kt")
@@ -377,7 +389,7 @@ public class CompilerLightClassTestGenerated extends AbstractCompilerLightClassT
@RunWith(JUnit3RunnerWithInners.class)
public static class Object extends AbstractCompilerLightClassTest {
public void testAllFilesPresentInObject() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses/object"), Pattern.compile("^([^.]+)\\.(kt|kts)$"), TargetBackend.ANY, true);
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses/object"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("SimpleObject.kt")
@@ -392,7 +404,7 @@ public class CompilerLightClassTestGenerated extends AbstractCompilerLightClassT
@RunWith(JUnit3RunnerWithInners.class)
public static class PublicField extends AbstractCompilerLightClassTest {
public void testAllFilesPresentInPublicField() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses/publicField"), Pattern.compile("^([^.]+)\\.(kt|kts)$"), TargetBackend.ANY, true);
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses/publicField"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("CompanionObject.kt")
@@ -407,25 +419,4 @@ public class CompilerLightClassTestGenerated extends AbstractCompilerLightClassT
doTest(fileName);
}
}
@TestMetadata("compiler/testData/asJava/lightClasses/script")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Script extends AbstractCompilerLightClassTest {
public void testAllFilesPresentInScript() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses/script"), Pattern.compile("^([^.]+)\\.(kt|kts)$"), TargetBackend.ANY, true);
}
@TestMetadata("HelloWorld.kts")
public void testHelloWorld() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/script/HelloWorld.kts");
doTest(fileName);
}
@TestMetadata("InnerClasses.kts")
public void testInnerClasses() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/script/InnerClasses.kts");
doTest(fileName);
}
}
}
@@ -23776,6 +23776,24 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
doTest(fileName);
}
@TestMetadata("assigningArraysToVarargsInAnnotations.kt")
public void testAssigningArraysToVarargsInAnnotations() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/varargs/assigningArraysToVarargsInAnnotations.kt");
doTest(fileName);
}
@TestMetadata("assigningSingleElementsInNamedFormAnnDeprecation.kt")
public void testAssigningSingleElementsInNamedFormAnnDeprecation() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/varargs/assigningSingleElementsInNamedFormAnnDeprecation.kt");
doTest(fileName);
}
@TestMetadata("assigningSingleElementsInNamedFormFunDeprecation.kt")
public void testAssigningSingleElementsInNamedFormFunDeprecation() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/varargs/assigningSingleElementsInNamedFormFunDeprecation.kt");
doTest(fileName);
}
@TestMetadata("kt1781.kt")
public void testKt1781() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/varargs/kt1781.kt");
@@ -23830,6 +23848,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
doTest(fileName);
}
@TestMetadata("noAssigningArraysToVarargsFeature.kt")
public void testNoAssigningArraysToVarargsFeature() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/varargs/noAssigningArraysToVarargsFeature.kt");
doTest(fileName);
}
@TestMetadata("NullableTypeForVarargArgument.kt")
public void testNullableTypeForVarargArgument() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/varargs/NullableTypeForVarargArgument.kt");
@@ -23776,6 +23776,24 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
doTest(fileName);
}
@TestMetadata("assigningArraysToVarargsInAnnotations.kt")
public void testAssigningArraysToVarargsInAnnotations() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/varargs/assigningArraysToVarargsInAnnotations.kt");
doTest(fileName);
}
@TestMetadata("assigningSingleElementsInNamedFormAnnDeprecation.kt")
public void testAssigningSingleElementsInNamedFormAnnDeprecation() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/varargs/assigningSingleElementsInNamedFormAnnDeprecation.kt");
doTest(fileName);
}
@TestMetadata("assigningSingleElementsInNamedFormFunDeprecation.kt")
public void testAssigningSingleElementsInNamedFormFunDeprecation() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/varargs/assigningSingleElementsInNamedFormFunDeprecation.kt");
doTest(fileName);
}
@TestMetadata("kt1781.kt")
public void testKt1781() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/varargs/kt1781.kt");
@@ -23830,6 +23848,12 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
doTest(fileName);
}
@TestMetadata("noAssigningArraysToVarargsFeature.kt")
public void testNoAssigningArraysToVarargsFeature() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/varargs/noAssigningArraysToVarargsFeature.kt");
doTest(fileName);
}
@TestMetadata("NullableTypeForVarargArgument.kt")
public void testNullableTypeForVarargArgument() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/varargs/NullableTypeForVarargArgument.kt");
@@ -19631,6 +19631,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/vararg"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
}
@TestMetadata("assigningArrayToVarargInAnnotation.kt")
public void testAssigningArrayToVarargInAnnotation() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/vararg/assigningArrayToVarargInAnnotation.kt");
doTest(fileName);
}
@TestMetadata("kt1978.kt")
public void testKt1978() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/vararg/kt1978.kt");
@@ -19631,6 +19631,12 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/vararg"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
}
@TestMetadata("assigningArrayToVarargInAnnotation.kt")
public void testAssigningArrayToVarargInAnnotation() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/vararg/assigningArrayToVarargInAnnotation.kt");
doTest(fileName);
}
@TestMetadata("kt1978.kt")
public void testKt1978() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/vararg/kt1978.kt");
@@ -63,6 +63,7 @@ enum class LanguageFeature(
CallableReferencesToClassMembersWithEmptyLHS(KOTLIN_1_2),
ThrowNpeOnExplicitEqualsForBoxedNull(KOTLIN_1_2),
JvmPackageName(KOTLIN_1_2),
AssigningArraysToVarargsInNamedFormInAnnotations(KOTLIN_1_2),
RestrictionOfValReassignmentViaBackingField(KOTLIN_1_3),
NestedClassesInEnumEntryShouldBeInner(KOTLIN_1_3),
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2016 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.
@@ -866,6 +866,10 @@ public abstract class KotlinBuiltIns {
return classFqNameEquals(descriptor, FQ_NAMES.array) || getPrimitiveArrayType(descriptor) != null;
}
public static boolean isArrayOrPrimitiveArray(@NotNull KotlinType type) {
return isArray(type) || isPrimitiveArray(type);
}
public static boolean isPrimitiveArray(@NotNull KotlinType type) {
ClassifierDescriptor descriptor = type.getConstructor().getDeclarationDescriptor();
return descriptor != null && getPrimitiveArrayType(descriptor) != null;
@@ -33,7 +33,7 @@ import java.util.regex.Pattern;
@RunWith(JUnit3RunnerWithInners.class)
public class IdeCompiledLightClassTestGenerated extends AbstractIdeCompiledLightClassTest {
public void testAllFilesPresentInLightClasses() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses"), Pattern.compile("^([^.]+)\\.(kt|kts)$"), TargetBackend.ANY, true, "local", "compilationErrors", "ideRegression");
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses"), Pattern.compile("^([^.]+)\\.kt$"), TargetBackend.ANY, true, "local", "compilationErrors", "ideRegression");
}
@TestMetadata("AnnotationClass.kt")
@@ -161,7 +161,7 @@ public class IdeCompiledLightClassTestGenerated extends AbstractIdeCompiledLight
@RunWith(JUnit3RunnerWithInners.class)
public static class Delegation extends AbstractIdeCompiledLightClassTest {
public void testAllFilesPresentInDelegation() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses/delegation"), Pattern.compile("^([^.]+)\\.(kt|kts)$"), TargetBackend.ANY, true);
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses/delegation"), Pattern.compile("^([^.]+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("Function.kt")
@@ -182,7 +182,7 @@ public class IdeCompiledLightClassTestGenerated extends AbstractIdeCompiledLight
@RunWith(JUnit3RunnerWithInners.class)
public static class Facades extends AbstractIdeCompiledLightClassTest {
public void testAllFilesPresentInFacades() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses/facades"), Pattern.compile("^([^.]+)\\.(kt|kts)$"), TargetBackend.ANY, true);
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses/facades"), Pattern.compile("^([^.]+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("MultiFile.kt")
@@ -209,7 +209,7 @@ public class IdeCompiledLightClassTestGenerated extends AbstractIdeCompiledLight
@RunWith(JUnit3RunnerWithInners.class)
public static class NullabilityAnnotations extends AbstractIdeCompiledLightClassTest {
public void testAllFilesPresentInNullabilityAnnotations() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses/nullabilityAnnotations"), Pattern.compile("^([^.]+)\\.(kt|kts)$"), TargetBackend.ANY, true);
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses/nullabilityAnnotations"), Pattern.compile("^([^.]+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("Class.kt")
@@ -326,7 +326,7 @@ public class IdeCompiledLightClassTestGenerated extends AbstractIdeCompiledLight
@RunWith(JUnit3RunnerWithInners.class)
public static class Object extends AbstractIdeCompiledLightClassTest {
public void testAllFilesPresentInObject() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses/object"), Pattern.compile("^([^.]+)\\.(kt|kts)$"), TargetBackend.ANY, true);
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses/object"), Pattern.compile("^([^.]+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("SimpleObject.kt")
@@ -341,7 +341,7 @@ public class IdeCompiledLightClassTestGenerated extends AbstractIdeCompiledLight
@RunWith(JUnit3RunnerWithInners.class)
public static class PublicField extends AbstractIdeCompiledLightClassTest {
public void testAllFilesPresentInPublicField() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses/publicField"), Pattern.compile("^([^.]+)\\.(kt|kts)$"), TargetBackend.ANY, true);
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses/publicField"), Pattern.compile("^([^.]+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("CompanionObject.kt")
@@ -356,25 +356,4 @@ public class IdeCompiledLightClassTestGenerated extends AbstractIdeCompiledLight
doTest(fileName);
}
}
@TestMetadata("compiler/testData/asJava/lightClasses/script")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Script extends AbstractIdeCompiledLightClassTest {
public void testAllFilesPresentInScript() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses/script"), Pattern.compile("^([^.]+)\\.(kt|kts)$"), TargetBackend.ANY, true);
}
@TestMetadata("HelloWorld.kts")
public void testHelloWorld() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/script/HelloWorld.kts");
doTest(fileName);
}
@TestMetadata("InnerClasses.kts")
public void testInnerClasses() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/script/InnerClasses.kts");
doTest(fileName);
}
}
}
@@ -33,7 +33,7 @@ import java.util.regex.Pattern;
@RunWith(JUnit3RunnerWithInners.class)
public class IdeLightClassTestGenerated extends AbstractIdeLightClassTest {
public void testAllFilesPresentInLightClasses() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses"), Pattern.compile("^([^.]+)\\.(kt|kts)$"), TargetBackend.ANY, true, "delegation");
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses"), Pattern.compile("^([^.]+)\\.kt$"), TargetBackend.ANY, true, "delegation");
}
@TestMetadata("AnnotationClass.kt")
@@ -161,7 +161,7 @@ public class IdeLightClassTestGenerated extends AbstractIdeLightClassTest {
@RunWith(JUnit3RunnerWithInners.class)
public static class CompilationErrors extends AbstractIdeLightClassTest {
public void testAllFilesPresentInCompilationErrors() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses/compilationErrors"), Pattern.compile("^([^.]+)\\.(kt|kts)$"), TargetBackend.ANY, true);
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses/compilationErrors"), Pattern.compile("^([^.]+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("AnnotationModifiers.kt")
@@ -212,7 +212,7 @@ public class IdeLightClassTestGenerated extends AbstractIdeLightClassTest {
@RunWith(JUnit3RunnerWithInners.class)
public static class Facades extends AbstractIdeLightClassTest {
public void testAllFilesPresentInFacades() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses/facades"), Pattern.compile("^([^.]+)\\.(kt|kts)$"), TargetBackend.ANY, true);
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses/facades"), Pattern.compile("^([^.]+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("MultiFile.kt")
@@ -239,7 +239,7 @@ public class IdeLightClassTestGenerated extends AbstractIdeLightClassTest {
@RunWith(JUnit3RunnerWithInners.class)
public static class IdeRegression extends AbstractIdeLightClassTest {
public void testAllFilesPresentInIdeRegression() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses/ideRegression"), Pattern.compile("^([^.]+)\\.(kt|kts)$"), TargetBackend.ANY, true);
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses/ideRegression"), Pattern.compile("^([^.]+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("AllOpenAnnotatedClasses.kt")
@@ -296,7 +296,7 @@ public class IdeLightClassTestGenerated extends AbstractIdeLightClassTest {
@RunWith(JUnit3RunnerWithInners.class)
public static class Local extends AbstractIdeLightClassTest {
public void testAllFilesPresentInLocal() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses/local"), Pattern.compile("^([^.]+)\\.(kt|kts)$"), TargetBackend.ANY, true);
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses/local"), Pattern.compile("^([^.]+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("DollarsInNameLocal.kt")
@@ -311,7 +311,7 @@ public class IdeLightClassTestGenerated extends AbstractIdeLightClassTest {
@RunWith(JUnit3RunnerWithInners.class)
public static class NullabilityAnnotations extends AbstractIdeLightClassTest {
public void testAllFilesPresentInNullabilityAnnotations() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses/nullabilityAnnotations"), Pattern.compile("^([^.]+)\\.(kt|kts)$"), TargetBackend.ANY, true);
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses/nullabilityAnnotations"), Pattern.compile("^([^.]+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("Class.kt")
@@ -428,7 +428,7 @@ public class IdeLightClassTestGenerated extends AbstractIdeLightClassTest {
@RunWith(JUnit3RunnerWithInners.class)
public static class Object extends AbstractIdeLightClassTest {
public void testAllFilesPresentInObject() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses/object"), Pattern.compile("^([^.]+)\\.(kt|kts)$"), TargetBackend.ANY, true);
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses/object"), Pattern.compile("^([^.]+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("SimpleObject.kt")
@@ -443,7 +443,7 @@ public class IdeLightClassTestGenerated extends AbstractIdeLightClassTest {
@RunWith(JUnit3RunnerWithInners.class)
public static class PublicField extends AbstractIdeLightClassTest {
public void testAllFilesPresentInPublicField() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses/publicField"), Pattern.compile("^([^.]+)\\.(kt|kts)$"), TargetBackend.ANY, true);
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses/publicField"), Pattern.compile("^([^.]+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("CompanionObject.kt")
@@ -458,25 +458,4 @@ public class IdeLightClassTestGenerated extends AbstractIdeLightClassTest {
doTest(fileName);
}
}
@TestMetadata("compiler/testData/asJava/lightClasses/script")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Script extends AbstractIdeLightClassTest {
public void testAllFilesPresentInScript() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses/script"), Pattern.compile("^([^.]+)\\.(kt|kts)$"), TargetBackend.ANY, true);
}
@TestMetadata("HelloWorld.kts")
public void testHelloWorld() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/script/HelloWorld.kts");
doTest(fileName);
}
@TestMetadata("InnerClasses.kts")
public void testInnerClasses() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/script/InnerClasses.kts");
doTest(fileName);
}
}
}
@@ -23657,6 +23657,18 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/vararg"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS, true);
}
@TestMetadata("assigningArrayToVarargInAnnotation.kt")
public void testAssigningArrayToVarargInAnnotation() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/vararg/assigningArrayToVarargInAnnotation.kt");
try {
doTest(fileName);
}
catch (Throwable ignore) {
return;
}
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
}
@TestMetadata("kt1978.kt")
public void testKt1978() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/vararg/kt1978.kt");