diff --git a/compiler/fir/analysis-tests/testData/resolve/expresssions/genericDescriptor.kt b/compiler/fir/analysis-tests/testData/resolve/expresssions/genericDescriptor.kt index 4f8e72981ba..8c23920ad8c 100644 --- a/compiler/fir/analysis-tests/testData/resolve/expresssions/genericDescriptor.kt +++ b/compiler/fir/analysis-tests/testData/resolve/expresssions/genericDescriptor.kt @@ -1,5 +1,5 @@ -// FILE: Descriptor.java // FULL_JDK +// FILE: Descriptor.java public interface Descriptor diff --git a/compiler/fir/analysis-tests/testData/resolve/expresssions/genericDiagnostic.kt b/compiler/fir/analysis-tests/testData/resolve/expresssions/genericDiagnostic.kt index 4a982f1cc1d..48b47cd69e4 100644 --- a/compiler/fir/analysis-tests/testData/resolve/expresssions/genericDiagnostic.kt +++ b/compiler/fir/analysis-tests/testData/resolve/expresssions/genericDiagnostic.kt @@ -1,5 +1,5 @@ -// FILE: Element.java // FULL_JDK +// FILE: Element.java public interface Element {} diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/StaticGenericMethod.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/StaticGenericMethod.kt index bfc2106cbb7..0a6dfd93d20 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/StaticGenericMethod.kt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/StaticGenericMethod.kt @@ -1,5 +1,5 @@ -// FILE: StaticOwner.java // FULL_JDK +// FILE: StaticOwner.java import org.jetbrains.annotations.NotNull; @@ -21,4 +21,4 @@ abstract class User { fun foo() { settings = StaticOwner.newInstance(settings.javaClass) } -} \ No newline at end of file +} diff --git a/compiler/test-infrastructure/tests/org/jetbrains/kotlin/test/directives/model/Directive.kt b/compiler/test-infrastructure/tests/org/jetbrains/kotlin/test/directives/model/Directive.kt index 024bcd7bb0a..621eb3a88fd 100644 --- a/compiler/test-infrastructure/tests/org/jetbrains/kotlin/test/directives/model/Directive.kt +++ b/compiler/test-infrastructure/tests/org/jetbrains/kotlin/test/directives/model/Directive.kt @@ -9,7 +9,18 @@ import org.jetbrains.kotlin.test.util.joinToArrayString // --------------------------- Directive declaration --------------------------- -sealed class Directive(val name: String, val description: String) { +enum class DirectiveApplicability( + val forGlobal: Boolean = false, + val forModule: Boolean = false, + val forFile: Boolean = false +) { + Any(forGlobal = true, forModule = true, forFile = true), + Global(forGlobal = true, forModule = true), + Module(forModule = true), + File(forFile = true) +} + +sealed class Directive(val name: String, val description: String, val applicability: DirectiveApplicability) { override fun toString(): String { return name } @@ -17,23 +28,26 @@ sealed class Directive(val name: String, val description: String) { class SimpleDirective( name: String, - description: String -) : Directive(name, description) + description: String, + applicability: DirectiveApplicability +) : Directive(name, description, applicability) class StringDirective( name: String, - description: String -) : Directive(name, description) + description: String, + applicability: DirectiveApplicability +) : Directive(name, description, applicability) class ValueDirective( name: String, description: String, + applicability: DirectiveApplicability, val parser: (String) -> T? -) : Directive(name, description) +) : Directive(name, description, applicability) // --------------------------- Registered directive --------------------------- -abstract class RegisteredDirectives { +abstract class RegisteredDirectives : Iterable { companion object { val Empty = RegisteredDirectivesImpl(emptyList(), emptyMap(), emptyMap()) } @@ -78,6 +92,15 @@ class RegisteredDirectivesImpl( valueDirectives.forEach { (d, v) -> appendLine(" $d: ${v.joinToArrayString()}")} } } + + @OptIn(ExperimentalStdlibApi::class) + override fun iterator(): Iterator { + return buildList { + addAll(simpleDirectives) + addAll(stringDirectives.keys) + addAll(valueDirectives.keys) + }.iterator() + } } class ComposedRegisteredDirectives( @@ -109,6 +132,10 @@ class ComposedRegisteredDirectives( override fun isEmpty(): Boolean { return containers.all { it.isEmpty() } } + + override fun iterator(): Iterator { + return containers.flatten().iterator() + } } // --------------------------- Utils --------------------------- diff --git a/compiler/test-infrastructure/tests/org/jetbrains/kotlin/test/directives/model/DirectivesContainer.kt b/compiler/test-infrastructure/tests/org/jetbrains/kotlin/test/directives/model/DirectivesContainer.kt index 00d6288a5f8..3446b5a60ca 100644 --- a/compiler/test-infrastructure/tests/org/jetbrains/kotlin/test/directives/model/DirectivesContainer.kt +++ b/compiler/test-infrastructure/tests/org/jetbrains/kotlin/test/directives/model/DirectivesContainer.kt @@ -20,28 +20,36 @@ abstract class SimpleDirectivesContainer : DirectivesContainer() { override operator fun get(name: String): Directive? = registeredDirectives[name] - protected fun directive(description: String): DirectiveDelegateProvider { - return DirectiveDelegateProvider { SimpleDirective(it, description) } + protected fun directive( + description: String, + applicability: DirectiveApplicability = DirectiveApplicability.Global + ): DirectiveDelegateProvider { + return DirectiveDelegateProvider { SimpleDirective(it, description, applicability) } } - protected fun stringDirective(description: String): DirectiveDelegateProvider { - return DirectiveDelegateProvider { StringDirective(it, description) } + protected fun stringDirective( + description: String, + applicability: DirectiveApplicability = DirectiveApplicability.Global + ): DirectiveDelegateProvider { + return DirectiveDelegateProvider { StringDirective(it, description, applicability) } } protected inline fun > enumDirective( description: String, + applicability: DirectiveApplicability = DirectiveApplicability.Global, noinline additionalParser: ((String) -> T?)? = null ): DirectiveDelegateProvider> { val possibleValues = enumValues() val parser: (String) -> T? = { value -> possibleValues.firstOrNull { it.name == value } ?: additionalParser?.invoke(value) } - return DirectiveDelegateProvider { ValueDirective(it, description, parser) } + return DirectiveDelegateProvider { ValueDirective(it, description, applicability, parser) } } protected fun valueDirective( description: String, + applicability: DirectiveApplicability = DirectiveApplicability.Global, parser: (String) -> T? ): DirectiveDelegateProvider> { - return DirectiveDelegateProvider { ValueDirective(it, description, parser) } + return DirectiveDelegateProvider { ValueDirective(it, description, applicability, parser) } } protected fun registerDirective(directive: Directive) { diff --git a/compiler/testData/codegen/box/coroutines/multiModule/inlineCrossModule.kt b/compiler/testData/codegen/box/coroutines/multiModule/inlineCrossModule.kt index dedd563e500..606a4962d8b 100644 --- a/compiler/testData/codegen/box/coroutines/multiModule/inlineCrossModule.kt +++ b/compiler/testData/codegen/box/coroutines/multiModule/inlineCrossModule.kt @@ -18,9 +18,9 @@ suspend fun notInlined( ): R = block() // MODULE: main(lib, support) -// FILE: main.kt // WITH_COROUTINES // WITH_RUNTIME +// FILE: main.kt import helpers.* import kotlin.coroutines.* import kotlin.coroutines.intrinsics.* diff --git a/compiler/testData/codegen/box/coroutines/multiModule/inlineFunctionWithOptionalParam.kt b/compiler/testData/codegen/box/coroutines/multiModule/inlineFunctionWithOptionalParam.kt index 0988b122ce9..b8b2597b182 100644 --- a/compiler/testData/codegen/box/coroutines/multiModule/inlineFunctionWithOptionalParam.kt +++ b/compiler/testData/codegen/box/coroutines/multiModule/inlineFunctionWithOptionalParam.kt @@ -8,9 +8,9 @@ inline fun foo(x: String = "OK"): String { } // MODULE: main(lib, support) -// FILE: main.kt // WITH_RUNTIME // WITH_COROUTINES +// FILE: main.kt import helpers.* import kotlin.coroutines.* import kotlin.coroutines.intrinsics.* diff --git a/compiler/testData/codegen/box/delegation/byMiddleInterface.kt b/compiler/testData/codegen/box/delegation/byMiddleInterface.kt index f4e61e75afa..9e316f9b5b8 100644 --- a/compiler/testData/codegen/box/delegation/byMiddleInterface.kt +++ b/compiler/testData/codegen/box/delegation/byMiddleInterface.kt @@ -1,4 +1,5 @@ // TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 // FILE: Base.java public interface Base { @@ -10,7 +11,6 @@ public interface Base { } // FILE: main.kt -// JVM_TARGET: 1.8 public interface BaseKotlin : Base { } diff --git a/compiler/testData/codegen/box/delegation/defaultOverride.kt b/compiler/testData/codegen/box/delegation/defaultOverride.kt index 25bdbf7a7f2..4675849a849 100644 --- a/compiler/testData/codegen/box/delegation/defaultOverride.kt +++ b/compiler/testData/codegen/box/delegation/defaultOverride.kt @@ -1,4 +1,5 @@ // TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 // FILE: Base.java public interface Base { @@ -10,7 +11,6 @@ public interface Base { } // FILE: main.kt -// JVM_TARGET: 1.8 public interface BaseKotlin : Base { override fun getValue() = "OK" diff --git a/compiler/testData/codegen/box/delegation/diamond.kt b/compiler/testData/codegen/box/delegation/diamond.kt index 7a539ee55bf..80172e13a7f 100644 --- a/compiler/testData/codegen/box/delegation/diamond.kt +++ b/compiler/testData/codegen/box/delegation/diamond.kt @@ -1,4 +1,5 @@ // TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 // FILE: Base.java public interface Base { @@ -18,7 +19,6 @@ public interface Base2 extends Base { } // FILE: main.kt -// JVM_TARGET: 1.8 interface KBase : Base diff --git a/compiler/testData/codegen/box/delegation/diamond2.kt b/compiler/testData/codegen/box/delegation/diamond2.kt index 251670895cc..1a6d0ccc8c7 100644 --- a/compiler/testData/codegen/box/delegation/diamond2.kt +++ b/compiler/testData/codegen/box/delegation/diamond2.kt @@ -1,4 +1,5 @@ // TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 // FILE: Base.java public interface Base { @@ -17,7 +18,6 @@ public interface Base2 extends Base { // FILE: main.kt -// JVM_TARGET: 1.8 interface KBase : Base { override fun test() = "O" + getValue() diff --git a/compiler/testData/codegen/box/delegation/inClassDeclaration.kt b/compiler/testData/codegen/box/delegation/inClassDeclaration.kt index e29eea6a650..541c697bae7 100644 --- a/compiler/testData/codegen/box/delegation/inClassDeclaration.kt +++ b/compiler/testData/codegen/box/delegation/inClassDeclaration.kt @@ -1,4 +1,5 @@ // TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 // FILE: Base.java public interface Base { @@ -10,7 +11,6 @@ public interface Base { } // FILE: main.kt -// JVM_TARGET: 1.8 class Fail : Base { override fun getValue() = "Fail" diff --git a/compiler/testData/codegen/box/delegation/mixed.kt b/compiler/testData/codegen/box/delegation/mixed.kt index 091fdbfd6e3..f570d9a988b 100644 --- a/compiler/testData/codegen/box/delegation/mixed.kt +++ b/compiler/testData/codegen/box/delegation/mixed.kt @@ -1,4 +1,5 @@ // TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 // FILE: Base.java public interface Base extends KBase { @@ -10,7 +11,6 @@ public interface Base extends KBase { } // FILE: main.kt -// JVM_TARGET: 1.8 interface KBase { fun getValue(): String diff --git a/compiler/testData/codegen/box/delegation/simple.kt b/compiler/testData/codegen/box/delegation/simple.kt index 2f176b6a473..d10855a639f 100644 --- a/compiler/testData/codegen/box/delegation/simple.kt +++ b/compiler/testData/codegen/box/delegation/simple.kt @@ -1,4 +1,5 @@ // TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 // FILE: Base.java public interface Base { @@ -10,7 +11,6 @@ public interface Base { } // FILE: main.kt -// JVM_TARGET: 1.8 class Fail : Base { override fun getValue() = "Fail" diff --git a/compiler/testData/codegen/box/delegation/simple1.0.kt b/compiler/testData/codegen/box/delegation/simple1.0.kt index 7d22a09f9ed..904157c6aa7 100644 --- a/compiler/testData/codegen/box/delegation/simple1.0.kt +++ b/compiler/testData/codegen/box/delegation/simple1.0.kt @@ -1,6 +1,7 @@ // !LANGUAGE: -NoDelegationToJavaDefaultInterfaceMembers // IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 // FILE: Base.java public interface Base { @@ -12,7 +13,6 @@ public interface Base { } // FILE: main.kt -// JVM_TARGET: 1.8 class OK : Base { override fun getValue() = "OK" diff --git a/compiler/testData/codegen/box/fakeOverride/privateFakeOverrides0.kt b/compiler/testData/codegen/box/fakeOverride/privateFakeOverrides0.kt index b4f805a0fe0..ada4c892a50 100644 --- a/compiler/testData/codegen/box/fakeOverride/privateFakeOverrides0.kt +++ b/compiler/testData/codegen/box/fakeOverride/privateFakeOverrides0.kt @@ -1,6 +1,6 @@ // MODULE: lib -// FILE: lib.kt // WITH_RUNTIME +// FILE: lib.kt import kotlin.test.assertEquals diff --git a/compiler/testData/codegen/box/fakeOverride/privateFakeOverrides1.kt b/compiler/testData/codegen/box/fakeOverride/privateFakeOverrides1.kt index b177cc918d0..6317714f618 100644 --- a/compiler/testData/codegen/box/fakeOverride/privateFakeOverrides1.kt +++ b/compiler/testData/codegen/box/fakeOverride/privateFakeOverrides1.kt @@ -1,6 +1,6 @@ // MODULE: lib -// FILE: lib.kt // WITH_RUNTIME +// FILE: lib.kt import kotlin.test.assertEquals diff --git a/compiler/testData/codegen/box/javaInterop/generics/kt42824.kt b/compiler/testData/codegen/box/javaInterop/generics/kt42824.kt index c2bc5b7f38c..e79361962eb 100644 --- a/compiler/testData/codegen/box/javaInterop/generics/kt42824.kt +++ b/compiler/testData/codegen/box/javaInterop/generics/kt42824.kt @@ -1,3 +1,6 @@ +// DONT_TARGET_EXACT_BACKEND: WASM +// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS_IR // FILE: DiagnosticFactory0.java import org.jetbrains.annotations.NotNull; @@ -10,9 +13,6 @@ public class DiagnosticFactory0 { } // FILE: test.kt -// DONT_TARGET_EXACT_BACKEND: WASM -// IGNORE_BACKEND: JS -// IGNORE_BACKEND: JS_IR class SimpleDiagnostic(val element: E) interface KtAnnotationEntry @@ -21,4 +21,4 @@ fun foo(error: DiagnosticFactory0, entry: KtAnnotationEntr error.on(entry) // used to be INAPPLICABLE_CANDIDATE } -fun box() = "OK" \ No newline at end of file +fun box() = "OK" diff --git a/compiler/testData/codegen/box/javaInterop/generics/kt42825.kt b/compiler/testData/codegen/box/javaInterop/generics/kt42825.kt index deae821819a..70ade460cbe 100644 --- a/compiler/testData/codegen/box/javaInterop/generics/kt42825.kt +++ b/compiler/testData/codegen/box/javaInterop/generics/kt42825.kt @@ -1,3 +1,6 @@ +// DONT_TARGET_EXACT_BACKEND: WASM +// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS_IR // FILE: Processor.java public interface Processor { @@ -5,9 +8,6 @@ public interface Processor { } // FILE: test.kt -// DONT_TARGET_EXACT_BACKEND: WASM -// IGNORE_BACKEND: JS -// IGNORE_BACKEND: JS_IR interface PsiModifierListOwner interface KtClassOrObject { @@ -23,4 +23,4 @@ fun execute(declaration: Any, consumer: Processor) { } } -fun box(): String = "OK" \ No newline at end of file +fun box(): String = "OK" diff --git a/compiler/testData/codegen/box/javaInterop/notNullAssertions/functionAssertion.kt b/compiler/testData/codegen/box/javaInterop/notNullAssertions/functionAssertion.kt index 3dee7701f44..5a39088ad03 100644 --- a/compiler/testData/codegen/box/javaInterop/notNullAssertions/functionAssertion.kt +++ b/compiler/testData/codegen/box/javaInterop/notNullAssertions/functionAssertion.kt @@ -1,5 +1,7 @@ // SKIP_JDK6 // TARGET_BACKEND: JVM +// WITH_RUNTIME +// FULL_JDK // FILE: F.java import java.util.function.Function; @@ -10,8 +12,6 @@ public class F { } // FILE: test.kt -// WITH_RUNTIME -// FULL_JDK fun test(f: (Int?) -> String): String { return F.passNull(f) } diff --git a/compiler/testData/codegen/box/javaInterop/notNullAssertions/incWithNullabilityAssertionOnExtensionReceiver.kt b/compiler/testData/codegen/box/javaInterop/notNullAssertions/incWithNullabilityAssertionOnExtensionReceiver.kt index 7eea297f2b7..056f1e429aa 100644 --- a/compiler/testData/codegen/box/javaInterop/notNullAssertions/incWithNullabilityAssertionOnExtensionReceiver.kt +++ b/compiler/testData/codegen/box/javaInterop/notNullAssertions/incWithNullabilityAssertionOnExtensionReceiver.kt @@ -1,6 +1,6 @@ // TARGET_BACKEND: JVM -// FILE: test.kt // WITH_RUNTIME +// FILE: test.kt import kotlin.test.* diff --git a/compiler/testData/codegen/box/javaInterop/notNullAssertions/incWithNullabilityAssertionOnExtensionReceiverInPrivateOperator.kt b/compiler/testData/codegen/box/javaInterop/notNullAssertions/incWithNullabilityAssertionOnExtensionReceiverInPrivateOperator.kt index 5a1d1602d93..9c18cde65ee 100644 --- a/compiler/testData/codegen/box/javaInterop/notNullAssertions/incWithNullabilityAssertionOnExtensionReceiverInPrivateOperator.kt +++ b/compiler/testData/codegen/box/javaInterop/notNullAssertions/incWithNullabilityAssertionOnExtensionReceiverInPrivateOperator.kt @@ -1,6 +1,6 @@ // TARGET_BACKEND: JVM -// FILE: test.kt // WITH_RUNTIME +// FILE: test.kt import kotlin.test.* diff --git a/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridge.kt b/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridge.kt index dff26aa4fea..8b893cb39c9 100644 --- a/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridge.kt +++ b/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridge.kt @@ -1,5 +1,7 @@ // !JVM_DEFAULT_MODE: all-compatibility // TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// WITH_RUNTIME // FILE: Simple.java public interface Simple extends KInterface2 { @@ -14,8 +16,6 @@ public class Foo implements Simple { } // FILE: main.kt -// JVM_TARGET: 1.8 -// WITH_RUNTIME interface KInterface { fun test2(p: T): T { diff --git a/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridge2.kt b/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridge2.kt index 2af4393c031..15bdaf20fa4 100644 --- a/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridge2.kt +++ b/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridge2.kt @@ -1,5 +1,7 @@ // !JVM_DEFAULT_MODE: all-compatibility // TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// WITH_RUNTIME // FILE: Simple.java public interface Simple extends KInterface2 { @@ -16,8 +18,6 @@ public class Foo implements Simple { } // FILE: main.kt -// JVM_TARGET: 1.8 -// WITH_RUNTIME interface KInterface { fun test2(p: T): T { diff --git a/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridge3.kt b/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridge3.kt index 9b0580bc2a9..871b6b64213 100644 --- a/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridge3.kt +++ b/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridge3.kt @@ -1,5 +1,7 @@ // !JVM_DEFAULT_MODE: all-compatibility // TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// WITH_RUNTIME // FILE: Simple.java public interface Simple extends KInterface3 { @@ -16,8 +18,6 @@ public class Foo implements Simple { } // FILE: main.kt -// JVM_TARGET: 1.8 -// WITH_RUNTIME interface KInterface { fun test2(p: T): T { diff --git a/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridgeWithProperties.kt b/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridgeWithProperties.kt index bfed4e6f0b8..704fc44cde0 100644 --- a/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridgeWithProperties.kt +++ b/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridgeWithProperties.kt @@ -1,5 +1,7 @@ // !JVM_DEFAULT_MODE: all-compatibility // TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// WITH_RUNTIME // FILE: Simple.java public interface Simple extends KInterface2 { @@ -14,8 +16,6 @@ public class Foo implements Simple { } // FILE: main.kt -// JVM_TARGET: 1.8 -// WITH_RUNTIME interface KInterface { diff --git a/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridgeWithProperties2.kt b/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridgeWithProperties2.kt index b61193b1e24..fe86ba1ba17 100644 --- a/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridgeWithProperties2.kt +++ b/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridgeWithProperties2.kt @@ -1,5 +1,7 @@ // !JVM_DEFAULT_MODE: all-compatibility // TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// WITH_RUNTIME // FILE: Simple.java public interface Simple extends KInterface2 { @@ -16,8 +18,6 @@ public class Foo implements Simple { } // FILE: main.kt -// JVM_TARGET: 1.8 -// WITH_RUNTIME interface KInterface { diff --git a/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridgeWithProperties3.kt b/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridgeWithProperties3.kt index b4be289cb7c..ef170cae8d8 100644 --- a/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridgeWithProperties3.kt +++ b/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/bridgeWithProperties3.kt @@ -1,5 +1,7 @@ // !JVM_DEFAULT_MODE: all-compatibility // TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// WITH_RUNTIME // FILE: Simple.java public interface Simple extends KInterface3 { @@ -14,8 +16,6 @@ public class Foo implements Simple { } // FILE: main.kt -// JVM_TARGET: 1.8 -// WITH_RUNTIME interface KInterface { diff --git a/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/callStackTrace.kt b/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/callStackTrace.kt index 66244c9597c..5f398116b70 100644 --- a/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/callStackTrace.kt +++ b/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/callStackTrace.kt @@ -2,6 +2,7 @@ // TARGET_BACKEND: JVM // FULL_JDK // WITH_RUNTIME +// JVM_TARGET: 1.8 // FILE: Simple.java public interface Simple extends KInterface { @@ -16,8 +17,6 @@ public class Foo implements Simple { } // FILE: main.kt -// JVM_TARGET: 1.8 -// WITH_RUNTIME interface KInterface { fun call(): List { diff --git a/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/inheritedJvmDefault.kt b/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/inheritedJvmDefault.kt index 86f309e3d4b..ee52eb6b0cf 100644 --- a/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/inheritedJvmDefault.kt +++ b/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/inheritedJvmDefault.kt @@ -1,5 +1,7 @@ // !JVM_DEFAULT_MODE: all-compatibility // TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// WITH_RUNTIME // FILE: Simple.java public interface Simple extends KInterface2 { @@ -14,8 +16,6 @@ public class Foo implements Simple { } // FILE: main.kt -// JVM_TARGET: 1.8 -// WITH_RUNTIME interface KInterface { fun test2(): String { diff --git a/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/simpleFunction.kt b/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/simpleFunction.kt index 829a302d7fc..27d58d78286 100644 --- a/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/simpleFunction.kt +++ b/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/simpleFunction.kt @@ -1,5 +1,7 @@ // !JVM_DEFAULT_MODE: all-compatibility // TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// WITH_RUNTIME // FILE: Simple.java public interface Simple extends KInterface { @@ -14,8 +16,6 @@ public class Foo implements Simple { } // FILE: main.kt -// JVM_TARGET: 1.8 -// WITH_RUNTIME interface KInterface { fun test2(): String { diff --git a/compiler/testData/codegen/box/jvm8/defaults/compatibility/bridge.kt b/compiler/testData/codegen/box/jvm8/defaults/compatibility/bridge.kt index 4d0b1343e1b..4b44ef3d22a 100644 --- a/compiler/testData/codegen/box/jvm8/defaults/compatibility/bridge.kt +++ b/compiler/testData/codegen/box/jvm8/defaults/compatibility/bridge.kt @@ -1,5 +1,7 @@ // !JVM_DEFAULT_MODE: compatibility // TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// WITH_RUNTIME // FILE: Simple.java public interface Simple extends KInterface2 { @@ -14,8 +16,6 @@ public class Foo implements Simple { } // FILE: main.kt -// JVM_TARGET: 1.8 -// WITH_RUNTIME interface KInterface { @JvmDefault diff --git a/compiler/testData/codegen/box/jvm8/defaults/compatibility/bridge2.kt b/compiler/testData/codegen/box/jvm8/defaults/compatibility/bridge2.kt index 5e6b9ec3a41..cb0ce44550d 100644 --- a/compiler/testData/codegen/box/jvm8/defaults/compatibility/bridge2.kt +++ b/compiler/testData/codegen/box/jvm8/defaults/compatibility/bridge2.kt @@ -1,5 +1,7 @@ // !JVM_DEFAULT_MODE: compatibility // TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// WITH_RUNTIME // FILE: Simple.java public interface Simple extends KInterface2 { @@ -16,8 +18,6 @@ public class Foo implements Simple { } // FILE: main.kt -// JVM_TARGET: 1.8 -// WITH_RUNTIME interface KInterface { @JvmDefault diff --git a/compiler/testData/codegen/box/jvm8/defaults/compatibility/bridge3.kt b/compiler/testData/codegen/box/jvm8/defaults/compatibility/bridge3.kt index e200ae225bf..c254900a5b7 100644 --- a/compiler/testData/codegen/box/jvm8/defaults/compatibility/bridge3.kt +++ b/compiler/testData/codegen/box/jvm8/defaults/compatibility/bridge3.kt @@ -1,5 +1,7 @@ // !JVM_DEFAULT_MODE: compatibility // TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// WITH_RUNTIME // FILE: Simple.java public interface Simple extends KInterface3 { @@ -16,8 +18,6 @@ public class Foo implements Simple { } // FILE: main.kt -// JVM_TARGET: 1.8 -// WITH_RUNTIME interface KInterface { @JvmDefault diff --git a/compiler/testData/codegen/box/jvm8/defaults/compatibility/bridgeWithProperties.kt b/compiler/testData/codegen/box/jvm8/defaults/compatibility/bridgeWithProperties.kt index e39bc76d620..d90ec95d184 100644 --- a/compiler/testData/codegen/box/jvm8/defaults/compatibility/bridgeWithProperties.kt +++ b/compiler/testData/codegen/box/jvm8/defaults/compatibility/bridgeWithProperties.kt @@ -1,5 +1,7 @@ // !JVM_DEFAULT_MODE: compatibility // TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// WITH_RUNTIME // FILE: Simple.java public interface Simple extends KInterface2 { @@ -14,8 +16,6 @@ public class Foo implements Simple { } // FILE: main.kt -// JVM_TARGET: 1.8 -// WITH_RUNTIME interface KInterface { diff --git a/compiler/testData/codegen/box/jvm8/defaults/compatibility/bridgeWithProperties2.kt b/compiler/testData/codegen/box/jvm8/defaults/compatibility/bridgeWithProperties2.kt index eb72cc03ac2..4e2bdcdb094 100644 --- a/compiler/testData/codegen/box/jvm8/defaults/compatibility/bridgeWithProperties2.kt +++ b/compiler/testData/codegen/box/jvm8/defaults/compatibility/bridgeWithProperties2.kt @@ -1,5 +1,7 @@ // !JVM_DEFAULT_MODE: compatibility // TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// WITH_RUNTIME // FILE: Simple.java public interface Simple extends KInterface2 { @@ -16,8 +18,6 @@ public class Foo implements Simple { } // FILE: main.kt -// JVM_TARGET: 1.8 -// WITH_RUNTIME interface KInterface { diff --git a/compiler/testData/codegen/box/jvm8/defaults/compatibility/bridgeWithProperties3.kt b/compiler/testData/codegen/box/jvm8/defaults/compatibility/bridgeWithProperties3.kt index 55df395bf87..53e346cc884 100644 --- a/compiler/testData/codegen/box/jvm8/defaults/compatibility/bridgeWithProperties3.kt +++ b/compiler/testData/codegen/box/jvm8/defaults/compatibility/bridgeWithProperties3.kt @@ -1,5 +1,7 @@ // !JVM_DEFAULT_MODE: compatibility // TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// WITH_RUNTIME // FILE: Simple.java public interface Simple extends KInterface3 { @@ -14,8 +16,6 @@ public class Foo implements Simple { } // FILE: main.kt -// JVM_TARGET: 1.8 -// WITH_RUNTIME interface KInterface { diff --git a/compiler/testData/codegen/box/jvm8/defaults/compatibility/inheritedJvmDefault.kt b/compiler/testData/codegen/box/jvm8/defaults/compatibility/inheritedJvmDefault.kt index f031ef38328..0e879b832fe 100644 --- a/compiler/testData/codegen/box/jvm8/defaults/compatibility/inheritedJvmDefault.kt +++ b/compiler/testData/codegen/box/jvm8/defaults/compatibility/inheritedJvmDefault.kt @@ -1,5 +1,7 @@ // !JVM_DEFAULT_MODE: compatibility // TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// WITH_RUNTIME // FILE: Simple.java public interface Simple extends KInterface2 { @@ -14,8 +16,6 @@ public class Foo implements Simple { } // FILE: main.kt -// JVM_TARGET: 1.8 -// WITH_RUNTIME interface KInterface { @JvmDefault diff --git a/compiler/testData/codegen/box/jvm8/defaults/compatibility/simpleFunction.kt b/compiler/testData/codegen/box/jvm8/defaults/compatibility/simpleFunction.kt index f5d9c43ba3c..db7ebb237de 100644 --- a/compiler/testData/codegen/box/jvm8/defaults/compatibility/simpleFunction.kt +++ b/compiler/testData/codegen/box/jvm8/defaults/compatibility/simpleFunction.kt @@ -1,5 +1,7 @@ // !JVM_DEFAULT_MODE: compatibility // TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// WITH_RUNTIME // FILE: Simple.java public interface Simple extends KInterface { @@ -14,8 +16,6 @@ public class Foo implements Simple { } // FILE: main.kt -// JVM_TARGET: 1.8 -// WITH_RUNTIME interface KInterface { @JvmDefault diff --git a/compiler/testData/codegen/box/jvm8/defaults/kt40920.kt b/compiler/testData/codegen/box/jvm8/defaults/kt40920.kt index 42bc8c65933..cb9d348c3b0 100644 --- a/compiler/testData/codegen/box/jvm8/defaults/kt40920.kt +++ b/compiler/testData/codegen/box/jvm8/defaults/kt40920.kt @@ -1,5 +1,7 @@ // !JVM_DEFAULT_MODE: enable // TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// WITH_RUNTIME // FILE: JBase.java public interface JBase extends Base { @@ -9,8 +11,6 @@ public interface JBase extends Base { } // FILE: main.kt -// JVM_TARGET: 1.8 -// WITH_RUNTIME interface Base { @JvmDefault diff --git a/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridge.kt b/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridge.kt index a47031c4e66..080f1da1955 100644 --- a/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridge.kt +++ b/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridge.kt @@ -1,5 +1,7 @@ // !JVM_DEFAULT_MODE: all // TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// WITH_RUNTIME // FILE: Simple.java public interface Simple extends KInterface2 { @@ -14,8 +16,6 @@ public class Foo implements Simple { } // FILE: main.kt -// JVM_TARGET: 1.8 -// WITH_RUNTIME interface KInterface { fun test2(p: T): T { diff --git a/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridge2.kt b/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridge2.kt index 32a7e78335d..790dc242ddb 100644 --- a/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridge2.kt +++ b/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridge2.kt @@ -1,5 +1,7 @@ // !JVM_DEFAULT_MODE: all // TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// WITH_RUNTIME // FILE: Simple.java public interface Simple extends KInterface2 { @@ -16,8 +18,6 @@ public class Foo implements Simple { } // FILE: main.kt -// JVM_TARGET: 1.8 -// WITH_RUNTIME interface KInterface { fun test2(p: T): T { diff --git a/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridge3.kt b/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridge3.kt index ab8518269a4..48847c91c42 100644 --- a/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridge3.kt +++ b/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridge3.kt @@ -1,5 +1,7 @@ // !JVM_DEFAULT_MODE: all // TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// WITH_RUNTIME // FILE: Simple.java public interface Simple extends KInterface3 { @@ -16,8 +18,6 @@ public class Foo implements Simple { } // FILE: main.kt -// JVM_TARGET: 1.8 -// WITH_RUNTIME interface KInterface { fun test2(p: T): T { diff --git a/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridgeWithProperties.kt b/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridgeWithProperties.kt index 501a8e65461..ebb2290eb4e 100644 --- a/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridgeWithProperties.kt +++ b/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridgeWithProperties.kt @@ -1,5 +1,7 @@ // !JVM_DEFAULT_MODE: all // TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// WITH_RUNTIME // FILE: Simple.java public interface Simple extends KInterface2 { @@ -14,8 +16,6 @@ public class Foo implements Simple { } // FILE: main.kt -// JVM_TARGET: 1.8 -// WITH_RUNTIME interface KInterface { diff --git a/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridgeWithProperties2.kt b/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridgeWithProperties2.kt index 28d1c51cf35..4ddef56ed3f 100644 --- a/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridgeWithProperties2.kt +++ b/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridgeWithProperties2.kt @@ -1,5 +1,7 @@ // !JVM_DEFAULT_MODE: all // TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// WITH_RUNTIME // FILE: Simple.java public interface Simple extends KInterface2 { @@ -16,8 +18,6 @@ public class Foo implements Simple { } // FILE: main.kt -// JVM_TARGET: 1.8 -// WITH_RUNTIME interface KInterface { diff --git a/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridgeWithProperties3.kt b/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridgeWithProperties3.kt index cf5eecf6aa5..d7e1531654b 100644 --- a/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridgeWithProperties3.kt +++ b/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/bridgeWithProperties3.kt @@ -1,5 +1,7 @@ // !JVM_DEFAULT_MODE: all // TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// WITH_RUNTIME // FILE: Simple.java public interface Simple extends KInterface3 { @@ -14,8 +16,6 @@ public class Foo implements Simple { } // FILE: main.kt -// JVM_TARGET: 1.8 -// WITH_RUNTIME interface KInterface { diff --git a/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/inheritedJvmDefault.kt b/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/inheritedJvmDefault.kt index 998353b6375..9fcb2f15971 100644 --- a/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/inheritedJvmDefault.kt +++ b/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/inheritedJvmDefault.kt @@ -1,5 +1,7 @@ // !JVM_DEFAULT_MODE: all // TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// WITH_RUNTIME // FILE: Simple.java public interface Simple extends KInterface2 { @@ -14,8 +16,6 @@ public class Foo implements Simple { } // FILE: main.kt -// JVM_TARGET: 1.8 -// WITH_RUNTIME interface KInterface { fun test2(): String { diff --git a/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/kt40920.kt b/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/kt40920.kt index dcd28bf5b6d..bc147b2f1a4 100644 --- a/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/kt40920.kt +++ b/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/kt40920.kt @@ -1,5 +1,7 @@ // !JVM_DEFAULT_MODE: all // TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// WITH_RUNTIME // FILE: JBase.java public interface JBase extends Base { @@ -9,8 +11,6 @@ public interface JBase extends Base { } // FILE: main.kt -// JVM_TARGET: 1.8 -// WITH_RUNTIME interface Base { fun test(): String = "Base" diff --git a/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/simpleFunction.kt b/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/simpleFunction.kt index c3a1e9bbb59..9283a38072f 100644 --- a/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/simpleFunction.kt +++ b/compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/simpleFunction.kt @@ -1,5 +1,7 @@ // !JVM_DEFAULT_MODE: all // TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// WITH_RUNTIME // FILE: Simple.java public interface Simple extends KInterface { @@ -14,8 +16,6 @@ public class Foo implements Simple { } // FILE: main.kt -// JVM_TARGET: 1.8 -// WITH_RUNTIME interface KInterface { fun test2(): String { diff --git a/compiler/testData/codegen/box/jvm8/interfaceFlag/superCall.kt b/compiler/testData/codegen/box/jvm8/interfaceFlag/superCall.kt index ee22e95abfe..e7ea8f0ed2b 100644 --- a/compiler/testData/codegen/box/jvm8/interfaceFlag/superCall.kt +++ b/compiler/testData/codegen/box/jvm8/interfaceFlag/superCall.kt @@ -1,4 +1,5 @@ // TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 // FILE: Simple.java public interface Simple { @@ -12,7 +13,6 @@ public interface Simple { } // FILE: main.kt -// JVM_TARGET: 1.8 class TestClass : Simple { override fun test(): String { return super.test() @@ -22,4 +22,4 @@ class TestClass : Simple { fun box(): String { return TestClass().test() + Simple.testStatic() -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/jvm8/interfaceFlag/superCallIndirect.kt b/compiler/testData/codegen/box/jvm8/interfaceFlag/superCallIndirect.kt index 49d613352bd..ffcb988f250 100644 --- a/compiler/testData/codegen/box/jvm8/interfaceFlag/superCallIndirect.kt +++ b/compiler/testData/codegen/box/jvm8/interfaceFlag/superCallIndirect.kt @@ -1,4 +1,5 @@ // TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 // FILE: Simple.java public interface Simple { @@ -12,7 +13,6 @@ public interface Simple { } // FILE: main.kt -// JVM_TARGET: 1.8 interface KSimple : Simple {} class TestClass : KSimple { @@ -24,4 +24,4 @@ class TestClass : KSimple { fun box(): String { return TestClass().test() + Simple.testStatic() -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/jvm8/javaDefaults/capturedSuperCall.kt b/compiler/testData/codegen/box/jvm8/javaDefaults/capturedSuperCall.kt index 7a154be1009..5757ce97209 100644 --- a/compiler/testData/codegen/box/jvm8/javaDefaults/capturedSuperCall.kt +++ b/compiler/testData/codegen/box/jvm8/javaDefaults/capturedSuperCall.kt @@ -1,4 +1,5 @@ // TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 // FILE: IBase.java interface IBase { @@ -8,7 +9,6 @@ interface IBase { } // FILE: Kotlin.kt -// JVM_TARGET: 1.8 open class Base { fun foo() = "OK" } diff --git a/compiler/testData/codegen/box/jvm8/javaDefaults/defaultMethodCallFromInterface.kt b/compiler/testData/codegen/box/jvm8/javaDefaults/defaultMethodCallFromInterface.kt index df269e8e02a..e8fe1a07f58 100644 --- a/compiler/testData/codegen/box/jvm8/javaDefaults/defaultMethodCallFromInterface.kt +++ b/compiler/testData/codegen/box/jvm8/javaDefaults/defaultMethodCallFromInterface.kt @@ -1,4 +1,5 @@ // TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 // FILE: Simple.java public interface Simple { @@ -12,7 +13,6 @@ public interface Simple { } // FILE: main.kt -// JVM_TARGET: 1.8 interface KInterface : Simple { fun bar(): String { return test("O") + Simple.testStatic("O") diff --git a/compiler/testData/codegen/box/jvm8/javaDefaults/defaultMethodCallViaClass.kt b/compiler/testData/codegen/box/jvm8/javaDefaults/defaultMethodCallViaClass.kt index 306986ae137..be17d4985c5 100644 --- a/compiler/testData/codegen/box/jvm8/javaDefaults/defaultMethodCallViaClass.kt +++ b/compiler/testData/codegen/box/jvm8/javaDefaults/defaultMethodCallViaClass.kt @@ -1,4 +1,5 @@ // TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 // FILE: Simple.java interface Simple { @@ -12,7 +13,6 @@ interface Simple { } // FILE: main.kt -// JVM_TARGET: 1.8 class Test : Simple {} fun box(): String { diff --git a/compiler/testData/codegen/box/jvm8/javaDefaults/defaultMethodCallViaInterface.kt b/compiler/testData/codegen/box/jvm8/javaDefaults/defaultMethodCallViaInterface.kt index c26fb7dff0e..df42e6386de 100644 --- a/compiler/testData/codegen/box/jvm8/javaDefaults/defaultMethodCallViaInterface.kt +++ b/compiler/testData/codegen/box/jvm8/javaDefaults/defaultMethodCallViaInterface.kt @@ -1,4 +1,5 @@ // TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 // FILE: Simple.java public interface Simple { @@ -12,7 +13,6 @@ public interface Simple { } // FILE: main.kt -// JVM_TARGET: 1.8 interface TestInterface : Simple {} class Test : TestInterface {} diff --git a/compiler/testData/codegen/box/jvm8/javaDefaults/defaultMethodOverride.kt b/compiler/testData/codegen/box/jvm8/javaDefaults/defaultMethodOverride.kt index 6deb9b3d6e9..e6e2c314177 100644 --- a/compiler/testData/codegen/box/jvm8/javaDefaults/defaultMethodOverride.kt +++ b/compiler/testData/codegen/box/jvm8/javaDefaults/defaultMethodOverride.kt @@ -1,4 +1,5 @@ // TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 // FILE: Simple.java public interface Simple { @@ -8,7 +9,6 @@ public interface Simple { } // FILE: main.kt -// JVM_TARGET: 1.8 interface KInterface: Simple { override fun test(s: String): String { diff --git a/compiler/testData/codegen/box/jvm8/javaDefaults/dontDelegateToDefaultMethods.kt b/compiler/testData/codegen/box/jvm8/javaDefaults/dontDelegateToDefaultMethods.kt index b1d313c5b4b..92fa0e23e4b 100644 --- a/compiler/testData/codegen/box/jvm8/javaDefaults/dontDelegateToDefaultMethods.kt +++ b/compiler/testData/codegen/box/jvm8/javaDefaults/dontDelegateToDefaultMethods.kt @@ -1,4 +1,5 @@ // TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 // FILE: Test.java interface Test { @@ -11,7 +12,6 @@ interface Test { } // FILE: main.kt -// JVM_TARGET: 1.8 class Child : Test { override fun call() : String { diff --git a/compiler/testData/codegen/box/jvm8/javaDefaults/inheritKotlin.kt b/compiler/testData/codegen/box/jvm8/javaDefaults/inheritKotlin.kt index e1edf9d0269..b19732ba591 100644 --- a/compiler/testData/codegen/box/jvm8/javaDefaults/inheritKotlin.kt +++ b/compiler/testData/codegen/box/jvm8/javaDefaults/inheritKotlin.kt @@ -1,4 +1,5 @@ // TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 // FILE: Simple.java interface Simple extends KInterface { @@ -8,7 +9,6 @@ interface Simple extends KInterface { } // FILE: main.kt -// JVM_TARGET: 1.8 interface KInterface { fun test(): String { return "base"; diff --git a/compiler/testData/codegen/box/jvm8/javaDefaults/invokeDefaultViaSuper.kt b/compiler/testData/codegen/box/jvm8/javaDefaults/invokeDefaultViaSuper.kt index 2c01176ff17..f3a71c44034 100644 --- a/compiler/testData/codegen/box/jvm8/javaDefaults/invokeDefaultViaSuper.kt +++ b/compiler/testData/codegen/box/jvm8/javaDefaults/invokeDefaultViaSuper.kt @@ -1,5 +1,6 @@ // SKIP_JDK6 // TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 // FILE: Test.java public interface Test { @@ -9,7 +10,6 @@ public interface Test { } // FILE: test.kt -// JVM_TARGET: 1.8 interface KInterface : Test { } diff --git a/compiler/testData/codegen/box/jvm8/javaDefaults/kt40920.kt b/compiler/testData/codegen/box/jvm8/javaDefaults/kt40920.kt index a923ce45f98..ca7b6462c4b 100644 --- a/compiler/testData/codegen/box/jvm8/javaDefaults/kt40920.kt +++ b/compiler/testData/codegen/box/jvm8/javaDefaults/kt40920.kt @@ -1,6 +1,7 @@ // !JVM_DEFAULT_MODE: disable // JVM_TARGET: 1.8 // TARGET_BACKEND: JVM +// WITH_RUNTIME // FILE: JBase.java public interface JBase extends Base { @@ -10,7 +11,6 @@ public interface JBase extends Base { } // FILE: main.kt -// WITH_RUNTIME interface Base { fun test(): String = "Base" diff --git a/compiler/testData/codegen/box/jvm8/javaDefaults/kt40920_java.kt b/compiler/testData/codegen/box/jvm8/javaDefaults/kt40920_java.kt index 07bc70caddf..3a098ffde2a 100644 --- a/compiler/testData/codegen/box/jvm8/javaDefaults/kt40920_java.kt +++ b/compiler/testData/codegen/box/jvm8/javaDefaults/kt40920_java.kt @@ -1,6 +1,7 @@ // !JVM_DEFAULT_MODE: disable // JVM_TARGET: 1.8 // TARGET_BACKEND: JVM +// WITH_RUNTIME // FILE: Base.java public interface Base { @@ -11,7 +12,6 @@ public interface Base { // FILE: main.kt -// WITH_RUNTIME interface LeftBase : Base interface Right : Base { diff --git a/compiler/testData/codegen/box/jvm8/javaDefaults/kt40920_java2.kt b/compiler/testData/codegen/box/jvm8/javaDefaults/kt40920_java2.kt index 1dd1bb39699..71f311f87dc 100644 --- a/compiler/testData/codegen/box/jvm8/javaDefaults/kt40920_java2.kt +++ b/compiler/testData/codegen/box/jvm8/javaDefaults/kt40920_java2.kt @@ -1,6 +1,7 @@ // !JVM_DEFAULT_MODE: disable // JVM_TARGET: 1.8 // TARGET_BACKEND: JVM +// WITH_RUNTIME // FILE: Base.java public interface Base { @@ -15,7 +16,6 @@ public interface Left extends Base { } // FILE: main.kt -// WITH_RUNTIME interface Right : Base { override fun test(): String = "OK" diff --git a/compiler/testData/codegen/box/jvm8/javaDefaults/kt40920_map.kt b/compiler/testData/codegen/box/jvm8/javaDefaults/kt40920_map.kt index dfad0aea567..b8b95adf319 100644 --- a/compiler/testData/codegen/box/jvm8/javaDefaults/kt40920_map.kt +++ b/compiler/testData/codegen/box/jvm8/javaDefaults/kt40920_map.kt @@ -1,9 +1,9 @@ // !JVM_DEFAULT_MODE: disable // JVM_TARGET: 1.8 // TARGET_BACKEND: JVM -// FILE: main.kt // WITH_RUNTIME // FULL_JDK +// FILE: main.kt var result = "" interface A : MutableMap @@ -72,4 +72,4 @@ fun box(): String { val value = map.getOrDefault("O", "OK") if (result != "O=fail;O;O;") return "fail 3: $result" return value -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/jvm8/javaDefaults/longChainOfKotlinExtendsFromJavaWithDefault.kt b/compiler/testData/codegen/box/jvm8/javaDefaults/longChainOfKotlinExtendsFromJavaWithDefault.kt index 05e0eb936ed..7cd55756e42 100644 --- a/compiler/testData/codegen/box/jvm8/javaDefaults/longChainOfKotlinExtendsFromJavaWithDefault.kt +++ b/compiler/testData/codegen/box/jvm8/javaDefaults/longChainOfKotlinExtendsFromJavaWithDefault.kt @@ -1,4 +1,5 @@ // TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 // FILE: Base.java public interface Base { @@ -8,7 +9,6 @@ public interface Base { } // FILE: derived.kt -// JVM_TARGET: 1.8 interface K1 : Base interface K2 : K1 diff --git a/compiler/testData/codegen/box/jvm8/javaDefaults/samOnInterfaceWithDefaultMethod.kt b/compiler/testData/codegen/box/jvm8/javaDefaults/samOnInterfaceWithDefaultMethod.kt index 9afd98732b1..5eb27508dcb 100644 --- a/compiler/testData/codegen/box/jvm8/javaDefaults/samOnInterfaceWithDefaultMethod.kt +++ b/compiler/testData/codegen/box/jvm8/javaDefaults/samOnInterfaceWithDefaultMethod.kt @@ -1,4 +1,5 @@ // TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 // FILE: JavaCall.java class JavaCall { @@ -23,7 +24,6 @@ interface Test { } // FILE: sam.kt -// JVM_TARGET: 1.8 fun box(): String { val lambda = { "X" } diff --git a/compiler/testData/codegen/box/oldLanguageVersions/javaInterop/notNullAssertions/incWithNullabilityAssertionOnExtensionReceiverInPrivateOperator_lv11.kt b/compiler/testData/codegen/box/oldLanguageVersions/javaInterop/notNullAssertions/incWithNullabilityAssertionOnExtensionReceiverInPrivateOperator_lv11.kt index 22817339509..7930d4caa95 100644 --- a/compiler/testData/codegen/box/oldLanguageVersions/javaInterop/notNullAssertions/incWithNullabilityAssertionOnExtensionReceiverInPrivateOperator_lv11.kt +++ b/compiler/testData/codegen/box/oldLanguageVersions/javaInterop/notNullAssertions/incWithNullabilityAssertionOnExtensionReceiverInPrivateOperator_lv11.kt @@ -1,7 +1,7 @@ // !LANGUAGE: -NullabilityAssertionOnExtensionReceiver // TARGET_BACKEND: JVM -// FILE: test.kt // WITH_RUNTIME +// FILE: test.kt private operator fun A.inc() = A() fun box(): String { @@ -14,4 +14,4 @@ fun box(): String { // FILE: A.java public class A { public static A n() { return null; } -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/oldLanguageVersions/javaInterop/notNullAssertions/incWithNullabilityAssertionOnExtensionReceiver_lv11.kt b/compiler/testData/codegen/box/oldLanguageVersions/javaInterop/notNullAssertions/incWithNullabilityAssertionOnExtensionReceiver_lv11.kt index 2b480ab26ea..32e4fb1942b 100644 --- a/compiler/testData/codegen/box/oldLanguageVersions/javaInterop/notNullAssertions/incWithNullabilityAssertionOnExtensionReceiver_lv11.kt +++ b/compiler/testData/codegen/box/oldLanguageVersions/javaInterop/notNullAssertions/incWithNullabilityAssertionOnExtensionReceiver_lv11.kt @@ -1,7 +1,7 @@ // !LANGUAGE: -NullabilityAssertionOnExtensionReceiver // TARGET_BACKEND: JVM -// FILE: test.kt // WITH_RUNTIME +// FILE: test.kt import kotlin.test.* diff --git a/compiler/testData/codegen/box/signatureAnnotations/defaultAndNamedCombination.kt b/compiler/testData/codegen/box/signatureAnnotations/defaultAndNamedCombination.kt index 4525a8a1180..24b7f3a199a 100644 --- a/compiler/testData/codegen/box/signatureAnnotations/defaultAndNamedCombination.kt +++ b/compiler/testData/codegen/box/signatureAnnotations/defaultAndNamedCombination.kt @@ -1,9 +1,9 @@ // IGNORE_BACKEND_FIR: JVM_IR // IGNORE_BACKEND: JVM_IR // TARGET_BACKEND: JVM +// ANDROID_ANNOTATIONS // FILE: A.java -// ANDROID_ANNOTATIONS import kotlin.annotations.jvm.internal.*; diff --git a/compiler/testData/codegen/box/signatureAnnotations/defaultBoxTypes.kt b/compiler/testData/codegen/box/signatureAnnotations/defaultBoxTypes.kt index 89dddf3b8e7..acd94051bf2 100644 --- a/compiler/testData/codegen/box/signatureAnnotations/defaultBoxTypes.kt +++ b/compiler/testData/codegen/box/signatureAnnotations/defaultBoxTypes.kt @@ -1,9 +1,9 @@ // IGNORE_BACKEND_FIR: JVM_IR // IGNORE_BACKEND: JVM_IR // TARGET_BACKEND: JVM +// ANDROID_ANNOTATIONS // FILE: A.java -// ANDROID_ANNOTATIONS import kotlin.annotations.jvm.internal.*; @@ -79,4 +79,4 @@ fun box(): String { } return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/signatureAnnotations/defaultEnumType.kt b/compiler/testData/codegen/box/signatureAnnotations/defaultEnumType.kt index 19a7df4e6f5..2eabc0de9b2 100644 --- a/compiler/testData/codegen/box/signatureAnnotations/defaultEnumType.kt +++ b/compiler/testData/codegen/box/signatureAnnotations/defaultEnumType.kt @@ -1,9 +1,9 @@ // IGNORE_BACKEND_FIR: JVM_IR // IGNORE_BACKEND: JVM_IR // TARGET_BACKEND: JVM +// ANDROID_ANNOTATIONS // FILE: Signs.java -// ANDROID_ANNOTATIONS public enum Signs { HELLO, diff --git a/compiler/testData/codegen/box/signatureAnnotations/defaultLongLiteral.kt b/compiler/testData/codegen/box/signatureAnnotations/defaultLongLiteral.kt index 01667dd4112..3432249dd8d 100644 --- a/compiler/testData/codegen/box/signatureAnnotations/defaultLongLiteral.kt +++ b/compiler/testData/codegen/box/signatureAnnotations/defaultLongLiteral.kt @@ -1,9 +1,9 @@ // IGNORE_BACKEND_FIR: JVM_IR // IGNORE_BACKEND: JVM_IR // TARGET_BACKEND: JVM +// ANDROID_ANNOTATIONS // FILE: A.java -// ANDROID_ANNOTATIONS import kotlin.annotations.jvm.internal.*; diff --git a/compiler/testData/codegen/box/signatureAnnotations/defaultMultipleParams.kt b/compiler/testData/codegen/box/signatureAnnotations/defaultMultipleParams.kt index 388d146a78a..9a8de425a9d 100644 --- a/compiler/testData/codegen/box/signatureAnnotations/defaultMultipleParams.kt +++ b/compiler/testData/codegen/box/signatureAnnotations/defaultMultipleParams.kt @@ -1,9 +1,9 @@ // IGNORE_BACKEND_FIR: JVM_IR // IGNORE_BACKEND: JVM_IR // TARGET_BACKEND: JVM +// ANDROID_ANNOTATIONS // FILE: A.java -// ANDROID_ANNOTATIONS import kotlin.annotations.jvm.internal.*; diff --git a/compiler/testData/codegen/box/signatureAnnotations/defaultNull.kt b/compiler/testData/codegen/box/signatureAnnotations/defaultNull.kt index c735e66f2f3..29a3f9cebee 100644 --- a/compiler/testData/codegen/box/signatureAnnotations/defaultNull.kt +++ b/compiler/testData/codegen/box/signatureAnnotations/defaultNull.kt @@ -1,9 +1,9 @@ // IGNORE_BACKEND_FIR: JVM_IR // IGNORE_BACKEND: JVM_IR // TARGET_BACKEND: JVM +// ANDROID_ANNOTATIONS // FILE: A.java -// ANDROID_ANNOTATIONS import kotlin.annotations.jvm.internal.*; @@ -55,4 +55,4 @@ fun box(): String { if (D().baz() != 42) return "FAIL 5" return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/signatureAnnotations/defaultNullableBoxTypes.kt b/compiler/testData/codegen/box/signatureAnnotations/defaultNullableBoxTypes.kt index 7a6c2d436b4..62249a7f70d 100644 --- a/compiler/testData/codegen/box/signatureAnnotations/defaultNullableBoxTypes.kt +++ b/compiler/testData/codegen/box/signatureAnnotations/defaultNullableBoxTypes.kt @@ -1,9 +1,9 @@ // IGNORE_BACKEND_FIR: JVM_IR // IGNORE_BACKEND: JVM_IR // TARGET_BACKEND: JVM +// ANDROID_ANNOTATIONS // FILE: A.java -// ANDROID_ANNOTATIONS import kotlin.annotations.jvm.internal.*; import org.jetbrains.annotations.*; @@ -80,4 +80,4 @@ fun box(): String { } return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/signatureAnnotations/defaultOverrides.kt b/compiler/testData/codegen/box/signatureAnnotations/defaultOverrides.kt index 99b591be472..6c41645a32e 100644 --- a/compiler/testData/codegen/box/signatureAnnotations/defaultOverrides.kt +++ b/compiler/testData/codegen/box/signatureAnnotations/defaultOverrides.kt @@ -1,9 +1,9 @@ // IGNORE_BACKEND_FIR: JVM_IR // IGNORE_BACKEND: JVM_IR // TARGET_BACKEND: JVM +// ANDROID_ANNOTATIONS // FILE: A.java -// ANDROID_ANNOTATIONS import kotlin.annotations.jvm.internal.*; @@ -37,4 +37,4 @@ fun box(): String { } return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/signatureAnnotations/defaultPrimitiveTypes.kt b/compiler/testData/codegen/box/signatureAnnotations/defaultPrimitiveTypes.kt index 9a194d7d4b8..99a5295c319 100644 --- a/compiler/testData/codegen/box/signatureAnnotations/defaultPrimitiveTypes.kt +++ b/compiler/testData/codegen/box/signatureAnnotations/defaultPrimitiveTypes.kt @@ -1,9 +1,9 @@ // IGNORE_BACKEND_FIR: JVM_IR // IGNORE_BACKEND: JVM_IR // TARGET_BACKEND: JVM +// ANDROID_ANNOTATIONS // FILE: A.java -// ANDROID_ANNOTATIONS import kotlin.annotations.jvm.internal.*; diff --git a/compiler/testData/codegen/box/signatureAnnotations/defaultValueInConstructor.kt b/compiler/testData/codegen/box/signatureAnnotations/defaultValueInConstructor.kt index f0a89a6a3a9..416fb512aab 100644 --- a/compiler/testData/codegen/box/signatureAnnotations/defaultValueInConstructor.kt +++ b/compiler/testData/codegen/box/signatureAnnotations/defaultValueInConstructor.kt @@ -1,9 +1,9 @@ // IGNORE_BACKEND_FIR: JVM_IR // IGNORE_BACKEND: JVM_IR // TARGET_BACKEND: JVM +// ANDROID_ANNOTATIONS // FILE: A.java -// ANDROID_ANNOTATIONS import kotlin.annotations.jvm.internal.*; diff --git a/compiler/testData/codegen/box/signatureAnnotations/defaultWithJavaBase.kt b/compiler/testData/codegen/box/signatureAnnotations/defaultWithJavaBase.kt index 8465bd6b52d..6e751c3cdb9 100644 --- a/compiler/testData/codegen/box/signatureAnnotations/defaultWithJavaBase.kt +++ b/compiler/testData/codegen/box/signatureAnnotations/defaultWithJavaBase.kt @@ -1,9 +1,9 @@ // IGNORE_BACKEND_FIR: JVM_IR // IGNORE_BACKEND: JVM_IR // TARGET_BACKEND: JVM +// ANDROID_ANNOTATIONS // FILE: A.java -// ANDROID_ANNOTATIONS import kotlin.annotations.jvm.internal.*; diff --git a/compiler/testData/codegen/box/signatureAnnotations/reorderedParameterNames.kt b/compiler/testData/codegen/box/signatureAnnotations/reorderedParameterNames.kt index 6227b07240c..fbd23206736 100644 --- a/compiler/testData/codegen/box/signatureAnnotations/reorderedParameterNames.kt +++ b/compiler/testData/codegen/box/signatureAnnotations/reorderedParameterNames.kt @@ -1,7 +1,7 @@ // TARGET_BACKEND: JVM +// ANDROID_ANNOTATIONS // FILE: A.java -// ANDROID_ANNOTATIONS import kotlin.annotations.jvm.internal.*; @@ -28,4 +28,4 @@ fun box(): String { } return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/traits/multipleImplFromJava.kt b/compiler/testData/codegen/box/traits/multipleImplFromJava.kt index 276f901456f..6d4d3983f9f 100644 --- a/compiler/testData/codegen/box/traits/multipleImplFromJava.kt +++ b/compiler/testData/codegen/box/traits/multipleImplFromJava.kt @@ -1,4 +1,5 @@ // TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 // FILE: I.java interface I { default String ifun() { return "fail"; } @@ -13,7 +14,6 @@ public class Z { public class Zz extends Z implements I {} // FILE: multipleImplFromJava.kt -// JVM_TARGET: 1.8 class Cc : Zz() diff --git a/compiler/testData/diagnostics/tests/inference/capturedTypes/capturedFlexibleIntersectionTypesWithDifferentBounds.fir.kt b/compiler/testData/diagnostics/tests/inference/capturedTypes/capturedFlexibleIntersectionTypesWithDifferentBounds.fir.kt index 088e4a26ebf..f808283850c 100644 --- a/compiler/testData/diagnostics/tests/inference/capturedTypes/capturedFlexibleIntersectionTypesWithDifferentBounds.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/capturedTypes/capturedFlexibleIntersectionTypesWithDifferentBounds.fir.kt @@ -1,6 +1,6 @@ -// FILE: Bar.java // !DIAGNOSTICS: -UNUSED_PARAMETER // SKIP_TXT +// FILE: Bar.java public class Bar { } diff --git a/compiler/testData/diagnostics/tests/inference/capturedTypes/capturedFlexibleIntersectionTypesWithDifferentBounds.kt b/compiler/testData/diagnostics/tests/inference/capturedTypes/capturedFlexibleIntersectionTypesWithDifferentBounds.kt index 39f61226a39..611e9e1b158 100644 --- a/compiler/testData/diagnostics/tests/inference/capturedTypes/capturedFlexibleIntersectionTypesWithDifferentBounds.kt +++ b/compiler/testData/diagnostics/tests/inference/capturedTypes/capturedFlexibleIntersectionTypesWithDifferentBounds.kt @@ -1,6 +1,6 @@ -// FILE: Bar.java // !DIAGNOSTICS: -UNUSED_PARAMETER // SKIP_TXT +// FILE: Bar.java public class Bar { } diff --git a/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/defaultEnum.fir.kt b/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/defaultEnum.fir.kt index 10f4ab7708b..00fba4d7682 100644 --- a/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/defaultEnum.fir.kt +++ b/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/defaultEnum.fir.kt @@ -1,5 +1,5 @@ -// FILE: Signs.java // ANDROID_ANNOTATIONS +// FILE: Signs.java public enum Signs { HELLO, @@ -64,4 +64,4 @@ fun test(){ a.baz() a.bam() -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/defaultEnum.kt b/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/defaultEnum.kt index 9acd15eee4f..da9c00ceb7f 100644 --- a/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/defaultEnum.kt +++ b/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/defaultEnum.kt @@ -1,5 +1,5 @@ -// FILE: Signs.java // ANDROID_ANNOTATIONS +// FILE: Signs.java public enum Signs { HELLO, @@ -64,4 +64,4 @@ fun test(){ a.baz() a.bam() -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/defaultLongLiteral.fir.kt b/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/defaultLongLiteral.fir.kt index 78bf0a516ad..fb58760dce0 100644 --- a/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/defaultLongLiteral.fir.kt +++ b/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/defaultLongLiteral.fir.kt @@ -1,5 +1,5 @@ -// FILE: A.java // ANDROID_ANNOTATIONS +// FILE: A.java import kotlin.annotations.jvm.internal.*; diff --git a/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/defaultLongLiteral.kt b/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/defaultLongLiteral.kt index f02358f1c9f..11c7b4ba3e4 100644 --- a/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/defaultLongLiteral.kt +++ b/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/defaultLongLiteral.kt @@ -1,5 +1,5 @@ -// FILE: A.java // ANDROID_ANNOTATIONS +// FILE: A.java import kotlin.annotations.jvm.internal.*; diff --git a/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/defaultNull.fir.kt b/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/defaultNull.fir.kt index b492eaa5f6f..9d374ae004d 100644 --- a/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/defaultNull.fir.kt +++ b/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/defaultNull.fir.kt @@ -1,5 +1,5 @@ -// FILE: A.java // ANDROID_ANNOTATIONS +// FILE: A.java import kotlin.annotations.jvm.internal.*; @@ -28,4 +28,4 @@ fun test(a: A, first: B, second: B) { second.foo() second.foo(5) -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/defaultNull.kt b/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/defaultNull.kt index 2e851602818..6d93e590297 100644 --- a/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/defaultNull.kt +++ b/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/defaultNull.kt @@ -1,5 +1,5 @@ -// FILE: A.java // ANDROID_ANNOTATIONS +// FILE: A.java import kotlin.annotations.jvm.internal.*; @@ -28,4 +28,4 @@ fun test(a: A, first: B, second: B) { second.foo() second.foo(5) -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/defaultNullAndParameter.kt b/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/defaultNullAndParameter.kt index f18e0a87d41..1387049e9df 100644 --- a/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/defaultNullAndParameter.kt +++ b/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/defaultNullAndParameter.kt @@ -1,6 +1,6 @@ // FIR_IDENTICAL -// FILE: A.java // ANDROID_ANNOTATIONS +// FILE: A.java import kotlin.annotations.jvm.internal.*; diff --git a/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/defaultParameter.fir.kt b/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/defaultParameter.fir.kt index 230257989ee..2795c35fcdb 100644 --- a/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/defaultParameter.fir.kt +++ b/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/defaultParameter.fir.kt @@ -1,5 +1,5 @@ -// FILE: A.java // ANDROID_ANNOTATIONS +// FILE: A.java import kotlin.annotations.jvm.internal.*; diff --git a/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/defaultParameter.kt b/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/defaultParameter.kt index b3e40b48c7b..be351fecb58 100644 --- a/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/defaultParameter.kt +++ b/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/defaultParameter.kt @@ -1,5 +1,5 @@ -// FILE: A.java // ANDROID_ANNOTATIONS +// FILE: A.java import kotlin.annotations.jvm.internal.*; diff --git a/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/emptyParameterName.fir.kt b/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/emptyParameterName.fir.kt index f9718064622..284a8a3aa16 100644 --- a/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/emptyParameterName.fir.kt +++ b/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/emptyParameterName.fir.kt @@ -1,5 +1,5 @@ -// FILE: A.java // ANDROID_ANNOTATIONS +// FILE: A.java import kotlin.annotations.jvm.internal.*; @@ -24,4 +24,4 @@ fun main() { test.missingName("arg") test.numberName("first") -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/emptyParameterName.kt b/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/emptyParameterName.kt index 769af592f37..161fa85a5bc 100644 --- a/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/emptyParameterName.kt +++ b/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/emptyParameterName.kt @@ -1,5 +1,5 @@ -// FILE: A.java // ANDROID_ANNOTATIONS +// FILE: A.java import kotlin.annotations.jvm.internal.*; @@ -24,4 +24,4 @@ fun main() { test.missingName("arg") test.numberName("first") -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/overridesDefaultValue.fir.kt b/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/overridesDefaultValue.fir.kt index fe5fecb195c..350353f2296 100644 --- a/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/overridesDefaultValue.fir.kt +++ b/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/overridesDefaultValue.fir.kt @@ -1,5 +1,5 @@ -// FILE: A.java // ANDROID_ANNOTATIONS +// FILE: A.java import kotlin.annotations.jvm.internal.*; diff --git a/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/overridesDefaultValue.kt b/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/overridesDefaultValue.kt index c92cd863e65..bf9bfd58166 100644 --- a/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/overridesDefaultValue.kt +++ b/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/overridesDefaultValue.kt @@ -1,5 +1,5 @@ -// FILE: A.java // ANDROID_ANNOTATIONS +// FILE: A.java import kotlin.annotations.jvm.internal.*; diff --git a/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/overridesParameterName.fir.kt b/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/overridesParameterName.fir.kt index 3c46406ebaf..b022821911c 100644 --- a/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/overridesParameterName.fir.kt +++ b/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/overridesParameterName.fir.kt @@ -1,5 +1,5 @@ -// FILE: A.java // ANDROID_ANNOTATIONS +// FILE: A.java import kotlin.annotations.jvm.internal.*; diff --git a/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/overridesParameterName.kt b/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/overridesParameterName.kt index bb64c719102..8c13de9edbb 100644 --- a/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/overridesParameterName.kt +++ b/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/overridesParameterName.kt @@ -1,5 +1,5 @@ -// FILE: A.java // ANDROID_ANNOTATIONS +// FILE: A.java import kotlin.annotations.jvm.internal.*; diff --git a/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/reorderedParameterNames.kt b/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/reorderedParameterNames.kt index 4aaa69f7cdb..037a24865c1 100644 --- a/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/reorderedParameterNames.kt +++ b/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/reorderedParameterNames.kt @@ -1,7 +1,7 @@ // FIR_IDENTICAL -// FILE: A.java // ANDROID_ANNOTATIONS +// FILE: A.java import kotlin.annotations.jvm.internal.*; public class A { @@ -15,4 +15,4 @@ fun main() { test.connect("127.0.0.1", 8080) test.connect(host = "127.0.0.1", port = 8080) test.connect(port = 8080, host = "127.0.0.1") -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/sameParameterName.fir.kt b/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/sameParameterName.fir.kt index 01a29b0c13c..9a1dd337a6d 100644 --- a/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/sameParameterName.fir.kt +++ b/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/sameParameterName.fir.kt @@ -1,6 +1,6 @@ -// FILE: A.java // ANDROID_ANNOTATIONS +// FILE: A.java import kotlin.annotations.jvm.internal.*; public class A { @@ -14,4 +14,4 @@ fun main() { test.same("hello", "world") test.same(ok = "hello", ok = world) test.same("hello", ok = "world") -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/sameParameterName.kt b/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/sameParameterName.kt index c6bacf0a039..c9aa9b97ec0 100644 --- a/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/sameParameterName.kt +++ b/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/sameParameterName.kt @@ -1,6 +1,6 @@ -// FILE: A.java // ANDROID_ANNOTATIONS +// FILE: A.java import kotlin.annotations.jvm.internal.*; public class A { @@ -14,4 +14,4 @@ fun main() { test.same("hello", "world") test.same(ok = "hello", ok = world) test.same("hello", ok = "world") -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/specialCharsParameterName.fir.kt b/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/specialCharsParameterName.fir.kt index 0070bd9f64e..b1b5dab88ea 100644 --- a/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/specialCharsParameterName.fir.kt +++ b/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/specialCharsParameterName.fir.kt @@ -1,5 +1,5 @@ -// FILE: A.java // ANDROID_ANNOTATIONS +// FILE: A.java import kotlin.annotations.jvm.internal.*; import kotlin.internal.*; @@ -21,4 +21,4 @@ fun main() { test.numberName(`42` = "world") test.numberName("world") test.numberName(field = "world") -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/specialCharsParameterName.kt b/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/specialCharsParameterName.kt index b9541b7e646..9220cc35987 100644 --- a/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/specialCharsParameterName.kt +++ b/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/specialCharsParameterName.kt @@ -1,5 +1,5 @@ -// FILE: A.java // ANDROID_ANNOTATIONS +// FILE: A.java import kotlin.annotations.jvm.internal.*; import kotlin.internal.*; @@ -21,4 +21,4 @@ fun main() { test.numberName(`42` = "world") test.numberName("world") test.numberName(field = "world") -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/stableParameterName.kt b/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/stableParameterName.kt index 834176d51cb..b6b925cc71e 100644 --- a/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/stableParameterName.kt +++ b/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/stableParameterName.kt @@ -1,6 +1,6 @@ // FIR_IDENTICAL -// FILE: A.java // ANDROID_ANNOTATIONS +// FILE: A.java import kotlin.annotations.jvm.internal.*; diff --git a/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/staticMethodWithDefaultValue.kt b/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/staticMethodWithDefaultValue.kt index c6dab56099a..70df865ef8d 100644 --- a/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/staticMethodWithDefaultValue.kt +++ b/compiler/testData/diagnostics/tests/j+k/signatureAnnotations/staticMethodWithDefaultValue.kt @@ -1,8 +1,8 @@ // FIR_IDENTICAL // IGNORE_BACKEND: JS, NATIVE -// FILE: A.java // ANDROID_ANNOTATIONS +// FILE: A.java import kotlin.annotations.jvm.internal.*; diff --git a/compiler/testData/diagnostics/tests/j+k/types/notNullTypeParameterWithKotlinNullable.fir.kt b/compiler/testData/diagnostics/tests/j+k/types/notNullTypeParameterWithKotlinNullable.fir.kt index fe2f57ae149..06f07e576f9 100644 --- a/compiler/testData/diagnostics/tests/j+k/types/notNullTypeParameterWithKotlinNullable.fir.kt +++ b/compiler/testData/diagnostics/tests/j+k/types/notNullTypeParameterWithKotlinNullable.fir.kt @@ -1,6 +1,6 @@ // !SKIP_JAVAC -// FILE: SLRUMap.java // !LANGUAGE: +ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated +// FILE: SLRUMap.java import org.jetbrains.annotations.NotNull; import java.util.List; diff --git a/compiler/testData/diagnostics/tests/j+k/types/notNullTypeParameterWithKotlinNullable.kt b/compiler/testData/diagnostics/tests/j+k/types/notNullTypeParameterWithKotlinNullable.kt index 6f3750e41e5..eca01079b02 100644 --- a/compiler/testData/diagnostics/tests/j+k/types/notNullTypeParameterWithKotlinNullable.kt +++ b/compiler/testData/diagnostics/tests/j+k/types/notNullTypeParameterWithKotlinNullable.kt @@ -1,6 +1,6 @@ // !SKIP_JAVAC -// FILE: SLRUMap.java // !LANGUAGE: +ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated +// FILE: SLRUMap.java import org.jetbrains.annotations.NotNull; import java.util.List; diff --git a/compiler/testData/diagnostics/tests/j+k/types/notNullTypeParameterWithKotlinNullableWarnings.fir.kt b/compiler/testData/diagnostics/tests/j+k/types/notNullTypeParameterWithKotlinNullableWarnings.fir.kt index a543c1946e4..f85cd4aa40b 100644 --- a/compiler/testData/diagnostics/tests/j+k/types/notNullTypeParameterWithKotlinNullableWarnings.fir.kt +++ b/compiler/testData/diagnostics/tests/j+k/types/notNullTypeParameterWithKotlinNullableWarnings.fir.kt @@ -1,6 +1,6 @@ // !SKIP_JAVAC -// FILE: SLRUMap.java // !LANGUAGE: -ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated +// FILE: SLRUMap.java import org.jetbrains.annotations.NotNull; import java.util.List; diff --git a/compiler/testData/diagnostics/tests/j+k/types/notNullTypeParameterWithKotlinNullableWarnings.kt b/compiler/testData/diagnostics/tests/j+k/types/notNullTypeParameterWithKotlinNullableWarnings.kt index d845d14c68d..f0f37293165 100644 --- a/compiler/testData/diagnostics/tests/j+k/types/notNullTypeParameterWithKotlinNullableWarnings.kt +++ b/compiler/testData/diagnostics/tests/j+k/types/notNullTypeParameterWithKotlinNullableWarnings.kt @@ -1,6 +1,6 @@ // !SKIP_JAVAC -// FILE: SLRUMap.java // !LANGUAGE: -ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated +// FILE: SLRUMap.java import org.jetbrains.annotations.NotNull; import java.util.List; diff --git a/compiler/testData/diagnostics/tests/multimodule/duplicateClass/collectionMethodStub.kt b/compiler/testData/diagnostics/tests/multimodule/duplicateClass/collectionMethodStub.kt index aa0e88d1590..60c747a0c2d 100644 --- a/compiler/testData/diagnostics/tests/multimodule/duplicateClass/collectionMethodStub.kt +++ b/compiler/testData/diagnostics/tests/multimodule/duplicateClass/collectionMethodStub.kt @@ -1,6 +1,6 @@ // FIR_IDENTICAL -// FILE: f1.kt // SKIP_TXT +// FILE: f1.kt package kotlin @@ -19,4 +19,4 @@ class C: MutableIterator { throw UnsupportedOperationException() } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/testsWithStdLib/InaccessibleInternalClass.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/InaccessibleInternalClass.fir.kt index 379189d3aef..d744b200b60 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/InaccessibleInternalClass.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/InaccessibleInternalClass.fir.kt @@ -1,10 +1,10 @@ +// SKIP_TXT // FILE: a.kt package p class FilteringSequence // FILE: b.kt -// SKIP_TXT package kotlin.sequences import p.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/InaccessibleInternalClass.kt b/compiler/testData/diagnostics/testsWithStdLib/InaccessibleInternalClass.kt index bb4f2196574..1ddb1aebd9c 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/InaccessibleInternalClass.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/InaccessibleInternalClass.kt @@ -1,10 +1,10 @@ +// SKIP_TXT // FILE: a.kt package p class FilteringSequence // FILE: b.kt -// SKIP_TXT package kotlin.sequences import p.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/performance/kt41741.kt b/compiler/testData/diagnostics/testsWithStdLib/inference/performance/kt41741.kt index d1efd92c4d1..4bf23c5ff67 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/inference/performance/kt41741.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/inference/performance/kt41741.kt @@ -1,8 +1,8 @@ // FIR_IDENTICAL -// FILE: Simple.java // FULL_JDK // WITH_RUNTIME // !DIAGNOSTICS: -UNUSED_PARAMETER -CAST_NEVER_SUCCEEDS -UNUSED_VARIABLE +// FILE: Simple.java import java.util.*; import java.util.function.Supplier; diff --git a/compiler/testData/foreignAnnotations/tests/aosp.kt b/compiler/testData/foreignAnnotations/tests/aosp.kt index 6abbe23f7f1..b4dd6a2731a 100644 --- a/compiler/testData/foreignAnnotations/tests/aosp.kt +++ b/compiler/testData/foreignAnnotations/tests/aosp.kt @@ -1,4 +1,5 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER +// SOURCE_RETENTION_ANNOTATIONS // FILE: A.java import com.android.annotations.*; @@ -21,7 +22,6 @@ public class A { } // FILE: main.kt -// SOURCE_RETENTION_ANNOTATIONS fun main(a: A, a1: A) { a.foo("", null)?.length diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/directives/CodegenTestDirectives.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/directives/CodegenTestDirectives.kt index 0819011bceb..b72f6694491 100644 --- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/directives/CodegenTestDirectives.kt +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/directives/CodegenTestDirectives.kt @@ -6,15 +6,19 @@ package org.jetbrains.kotlin.test.directives import org.jetbrains.kotlin.test.TargetBackend +import org.jetbrains.kotlin.test.directives.model.DirectiveApplicability +import org.jetbrains.kotlin.test.directives.model.DirectiveApplicability.Global import org.jetbrains.kotlin.test.directives.model.SimpleDirectivesContainer object CodegenTestDirectives : SimpleDirectivesContainer() { val IGNORE_BACKEND by enumDirective( - description = "Ignore failures of test on target backend" + description = "Ignore failures of test on target backend", + applicability = Global ) val IGNORE_BACKEND_FIR by enumDirective( - description = "Ignore specific backend if test uses FIR" + description = "Ignore specific backend if test uses FIR", + applicability = Global ) val JAVAC_OPTIONS by stringDirective( @@ -29,7 +33,8 @@ object CodegenTestDirectives : SimpleDirectivesContainer() { ) val CHECK_BYTECODE_LISTING by directive( - description = "Dump resulting bytecode to .txt or _ir.txt file" + description = "Dump resulting bytecode to .txt or _ir.txt file", + applicability = Global ) val RUN_DEX_CHECKER by directive( diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/directives/DiagnosticsDirectives.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/directives/DiagnosticsDirectives.kt index 487acb809f7..9d55370f74e 100644 --- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/directives/DiagnosticsDirectives.kt +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/directives/DiagnosticsDirectives.kt @@ -7,6 +7,9 @@ package org.jetbrains.kotlin.test.directives import org.jetbrains.kotlin.test.backend.handlers.JvmBackendDiagnosticsHandler import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.USE_JAVAC +import org.jetbrains.kotlin.test.directives.model.DirectiveApplicability +import org.jetbrains.kotlin.test.directives.model.DirectiveApplicability.Any +import org.jetbrains.kotlin.test.directives.model.DirectiveApplicability.Global import org.jetbrains.kotlin.test.directives.model.SimpleDirectivesContainer object DiagnosticsDirectives : SimpleDirectivesContainer() { diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/directives/FirDiagnosticsDirectives.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/directives/FirDiagnosticsDirectives.kt index 0edefff5924..05a4249f885 100644 --- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/directives/FirDiagnosticsDirectives.kt +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/directives/FirDiagnosticsDirectives.kt @@ -5,6 +5,7 @@ package org.jetbrains.kotlin.test.directives +import org.jetbrains.kotlin.test.directives.model.DirectiveApplicability.Global import org.jetbrains.kotlin.test.directives.model.SimpleDirectivesContainer object FirDiagnosticsDirectives : SimpleDirectivesContainer() { @@ -12,17 +13,20 @@ object FirDiagnosticsDirectives : SimpleDirectivesContainer() { description = """ Dumps control flow graphs of all declarations to `testName.dot` file This directive may be applied only to all modules - """.trimIndent() + """.trimIndent(), + applicability = Global ) val FIR_DUMP by directive( description = """ Dumps resulting fir to `testName.fir` file - """.trimIndent() + """.trimIndent(), + applicability = Global ) val FIR_IDENTICAL by directive( - description = "Contents of fir test data file and FE 1.0 are identical" + description = "Contents of fir test data file and FE 1.0 are identical", + applicability = Global ) val USE_LIGHT_TREE by directive( @@ -33,7 +37,8 @@ object FirDiagnosticsDirectives : SimpleDirectivesContainer() { description = """ Enable comparing diagnostics between PSI and light tree modes For enabling light tree mode use $USE_LIGHT_TREE directive - """.trimIndent() + """.trimIndent(), + applicability = Global ) val WITH_EXTENDED_CHECKERS by directive( diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/impl/ModuleStructureExtractorImpl.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/impl/ModuleStructureExtractorImpl.kt index ec63451a9d9..40ccbbe429a 100644 --- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/impl/ModuleStructureExtractorImpl.kt +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/impl/ModuleStructureExtractorImpl.kt @@ -17,6 +17,7 @@ import org.jetbrains.kotlin.test.builders.LanguageVersionSettingsBuilder import org.jetbrains.kotlin.test.directives.AdditionalFilesDirectives import org.jetbrains.kotlin.test.directives.ModuleStructureDirectives import org.jetbrains.kotlin.test.directives.model.ComposedRegisteredDirectives +import org.jetbrains.kotlin.test.directives.model.Directive import org.jetbrains.kotlin.test.directives.model.DirectivesContainer import org.jetbrains.kotlin.test.directives.model.RegisteredDirectives import org.jetbrains.kotlin.test.model.* @@ -240,14 +241,38 @@ class ModuleStructureExtractorImpl( } private fun finishGlobalDirectives() { - globalDirectives = directivesBuilder.build() + globalDirectives = directivesBuilder.build().also { directives -> + directives.forEach { it.checkDirectiveApplicability(contextIsGlobal = true) } + } resetModuleCaches() resetFileCaches() } + @OptIn(ExperimentalStdlibApi::class) + private fun Directive.checkDirectiveApplicability( + contextIsGlobal: Boolean = false, + contextIsModule: Boolean = false, + contextIsFile: Boolean = false + ) { + when { + applicability.forGlobal && contextIsGlobal -> return + applicability.forModule && contextIsModule -> return + applicability.forFile && contextIsFile -> return + } + val context = buildList { + if (contextIsGlobal) add("Global") + if (contextIsModule) add("Module") + if (contextIsFile) add("File") + }.joinToString("|") + error("Directive $this has $applicability applicability but it declared in $context") + } + private fun finishModule() { finishFile() + val isImplicitModule = currentModuleName == null val moduleDirectives = moduleDirectivesBuilder.build() + testServices.defaultDirectives + globalDirectives + moduleDirectives.forEach { it.checkDirectiveApplicability(contextIsGlobal = isImplicitModule, contextIsModule = true) } + currentModuleLanguageVersionSettingsBuilder.configureUsingDirectives(moduleDirectives, environmentConfigurators) val moduleName = currentModuleName ?: defaultModuleName val testModule = TestModule( @@ -298,6 +323,9 @@ class ModuleStructureExtractorImpl( if (filesOfCurrentModule.any { it.name == filename }) { error("File with name \"$filename\" already defined in module ${currentModuleName ?: actualDefaultFileName}") } + val directives = fileDirectivesBuilder?.build()?.also { directives -> + directives.forEach { it.checkDirectiveApplicability(contextIsFile = true) } + } filesOfCurrentModule.add( TestFile( relativePath = filename, @@ -305,7 +333,7 @@ class ModuleStructureExtractorImpl( originalFile = currentTestDataFile, startLineNumberInOriginalFile = startLineNumberOfCurrentFile, isAdditional = false, - directives = fileDirectivesBuilder?.build() ?: RegisteredDirectives.Empty + directives = directives ?: RegisteredDirectives.Empty ) ) firstFileInModule = false @@ -333,6 +361,8 @@ class ModuleStructureExtractorImpl( private fun resetFileCaches() { if (!firstFileInModule) { linesOfCurrentFile = mutableListOf() + } + if (firstFileInModule) { moduleDirectivesBuilder = directivesBuilder } currentFileName = null