Add mode to run kapt with JVM IR, use in tests
Currently JVM IR is not supported in kapt, so almost all tests are failing, and thus are muted with IGNORE_BACKEND. #KT-49682
This commit is contained in:
@@ -85,6 +85,11 @@ public class JVMConfigurationKeys {
|
||||
public static final CompilerConfigurationKey<Boolean> IR =
|
||||
CompilerConfigurationKey.create("IR");
|
||||
|
||||
// Temporary option to make it possible to test kapt with JVM IR. As soon as all tests start to pass, it can be removed,
|
||||
// and the backend (old or IR) will be deduced from the compiler arguments provided by the user.
|
||||
public static final CompilerConfigurationKey<Boolean> USE_KAPT_WITH_JVM_IR =
|
||||
CompilerConfigurationKey.create("Enable JVM IR for kapt");
|
||||
|
||||
public static final CompilerConfigurationKey<Boolean> USE_PSI_CLASS_FILES_READING =
|
||||
CompilerConfigurationKey.create("use a slower (PSI-based) class files reading implementation");
|
||||
|
||||
|
||||
@@ -185,9 +185,9 @@ object GenerationUtils {
|
||||
analysisResult: AnalysisResult,
|
||||
configureGenerationState: GenerationState.Builder.() -> Unit = {},
|
||||
): GenerationState {
|
||||
/* Currently Kapt3 only works with the old JVM backend, so disable IR for everything except actual bytecode generation. */
|
||||
val isIrBackend =
|
||||
classBuilderFactory.classBuilderMode == ClassBuilderMode.FULL && configuration.getBoolean(JVMConfigurationKeys.IR)
|
||||
(classBuilderFactory.classBuilderMode == ClassBuilderMode.FULL && configuration.getBoolean(JVMConfigurationKeys.IR)) ||
|
||||
configuration.getBoolean(JVMConfigurationKeys.USE_KAPT_WITH_JVM_IR)
|
||||
val generationState = GenerationState.Builder(
|
||||
project, classBuilderFactory, analysisResult.moduleDescriptor, analysisResult.bindingContext,
|
||||
files, configuration
|
||||
|
||||
@@ -13,6 +13,7 @@ dependencies {
|
||||
api(project(":compiler:frontend"))
|
||||
api(project(":compiler:frontend.java"))
|
||||
api(project(":compiler:plugin-api"))
|
||||
implementation(project(":compiler:backend.jvm.entrypoint"))
|
||||
|
||||
compileOnly(toolsJarApi())
|
||||
compileOnly(project(":kotlin-annotation-processing-cli"))
|
||||
|
||||
@@ -24,23 +24,27 @@ import com.sun.tools.javac.tree.TreeMaker
|
||||
import com.sun.tools.javac.util.Context
|
||||
import org.jetbrains.kotlin.analyzer.AnalysisResult
|
||||
import org.jetbrains.kotlin.backend.common.output.OutputFile
|
||||
import org.jetbrains.kotlin.backend.jvm.JvmIrCodegenFactory
|
||||
import org.jetbrains.kotlin.base.kapt3.AptMode.APT_ONLY
|
||||
import org.jetbrains.kotlin.base.kapt3.AptMode.WITH_COMPILATION
|
||||
import org.jetbrains.kotlin.base.kapt3.DetectMemoryLeaksMode
|
||||
import org.jetbrains.kotlin.base.kapt3.KaptFlag
|
||||
import org.jetbrains.kotlin.base.kapt3.KaptOptions
|
||||
import org.jetbrains.kotlin.base.kapt3.collectJavaSourceFiles
|
||||
import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity.OUTPUT
|
||||
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
|
||||
import org.jetbrains.kotlin.cli.common.messages.OutputMessageUtil
|
||||
import org.jetbrains.kotlin.cli.common.output.writeAll
|
||||
import org.jetbrains.kotlin.cli.jvm.plugins.ServiceLoaderLite
|
||||
import org.jetbrains.kotlin.codegen.ClassBuilderMode
|
||||
import org.jetbrains.kotlin.codegen.DefaultCodegenFactory
|
||||
import org.jetbrains.kotlin.codegen.KotlinCodegenFacade
|
||||
import org.jetbrains.kotlin.codegen.OriginCollectingClassBuilderFactory
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState
|
||||
import org.jetbrains.kotlin.config.CommonConfigurationKeys
|
||||
import org.jetbrains.kotlin.config.CompilerConfiguration
|
||||
import org.jetbrains.kotlin.config.JVMConfigurationKeys
|
||||
import org.jetbrains.kotlin.container.ComponentProvider
|
||||
import org.jetbrains.kotlin.context.ProjectContext
|
||||
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
||||
@@ -263,6 +267,7 @@ abstract class AbstractKapt3Extension(
|
||||
type = "java-production"
|
||||
)
|
||||
|
||||
val isIrBackend = compilerConfiguration.getBoolean(JVMConfigurationKeys.USE_KAPT_WITH_JVM_IR)
|
||||
val generationState = GenerationState.Builder(
|
||||
project,
|
||||
builderFactory,
|
||||
@@ -271,7 +276,12 @@ abstract class AbstractKapt3Extension(
|
||||
files,
|
||||
compilerConfiguration
|
||||
).targetId(targetId)
|
||||
.isIrBackend(false)
|
||||
.isIrBackend(isIrBackend)
|
||||
.codegenFactory(
|
||||
if (isIrBackend)
|
||||
JvmIrCodegenFactory(compilerConfiguration, compilerConfiguration.get(CLIConfigurationKeys.PHASE_CONFIG))
|
||||
else DefaultCodegenFactory
|
||||
)
|
||||
.build()
|
||||
|
||||
val (classFilesCompilationTime) = measureTimeMillis {
|
||||
|
||||
-4
@@ -7,10 +7,6 @@ package org.jetbrains.kotlin.kapt3.test
|
||||
|
||||
import org.jetbrains.kotlin.test.TargetBackend
|
||||
|
||||
/*
|
||||
Currently Kapt3 only works with the old backend. To enable IR, modify the isIrBackend variable computation in GenerationsUtils.compileFiles()
|
||||
*/
|
||||
|
||||
abstract class AbstractIrClassFileToSourceStubConverterTest : AbstractClassFileToSourceStubConverterTest() {
|
||||
override val backend = TargetBackend.JVM_IR
|
||||
}
|
||||
|
||||
+10
-1
@@ -37,6 +37,8 @@ import org.jetbrains.kotlin.codegen.ClassBuilderMode
|
||||
import org.jetbrains.kotlin.codegen.CodegenTestFiles
|
||||
import org.jetbrains.kotlin.codegen.GenerationUtils
|
||||
import org.jetbrains.kotlin.codegen.OriginCollectingClassBuilderFactory
|
||||
import org.jetbrains.kotlin.config.CompilerConfiguration
|
||||
import org.jetbrains.kotlin.config.JVMConfigurationKeys
|
||||
import org.jetbrains.kotlin.extensions.StorageComponentContainerContributor
|
||||
import org.jetbrains.kotlin.kapt.base.test.JavaKaptContextTest
|
||||
import org.jetbrains.kotlin.kapt3.Kapt3ComponentRegistrar.KaptComponentContributor
|
||||
@@ -55,7 +57,6 @@ import org.jetbrains.kotlin.resolve.jvm.extensions.PartialAnalysisHandlerExtensi
|
||||
import org.jetbrains.kotlin.test.ConfigurationKind
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||
import org.jetbrains.kotlin.test.TestJdkKind
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil
|
||||
import org.jetbrains.kotlin.test.util.trimTrailingWhitespacesAndAddNewlineAtEOF
|
||||
import org.jetbrains.kotlin.utils.PathUtil
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstance
|
||||
@@ -172,6 +173,14 @@ abstract class AbstractKotlinKapt3Test : KotlinKapt3TestBase() {
|
||||
}
|
||||
}
|
||||
|
||||
override fun updateConfiguration(configuration: CompilerConfiguration) {
|
||||
super.updateConfiguration(configuration)
|
||||
|
||||
if (backend.isIR) {
|
||||
configuration.put(JVMConfigurationKeys.USE_KAPT_WITH_JVM_IR, true)
|
||||
}
|
||||
}
|
||||
|
||||
protected fun convert(
|
||||
kaptContext: KaptContextForStubGeneration,
|
||||
javaFiles: List<File>,
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
enum class E {
|
||||
X {
|
||||
override fun a() {}
|
||||
@@ -34,4 +36,4 @@ enum class E3(val a: String) {
|
||||
|
||||
enum class E4(val a: String, val b: Int, val c: Long, val d: Boolean) {
|
||||
X("", 4, 2L, true)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,4 +6,4 @@ abstract class Base {
|
||||
class Impl : Base() {
|
||||
override fun doJob(job: String, delay: Int) {}
|
||||
override fun <T : CharSequence> doJobGeneric(job: T, delay: Int) {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// CORRECT_ERROR_TYPES
|
||||
// NO_VALIDATION
|
||||
|
||||
@@ -25,4 +26,4 @@ class Test {
|
||||
|
||||
class Test2 {
|
||||
lateinit var date: MyDate
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// CORRECT_ERROR_TYPES
|
||||
// NO_VALIDATION
|
||||
|
||||
@@ -29,4 +30,4 @@ class Foo
|
||||
class Bar
|
||||
|
||||
@Anno(impls = [Joo::class])
|
||||
class Boo
|
||||
class Boo
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
annotation class Anno1
|
||||
enum class Colors { WHITE, BLACK }
|
||||
annotation class Anno2(
|
||||
@@ -32,4 +34,4 @@ class TestAnno2 {
|
||||
|
||||
enum class Enum1 {
|
||||
BLACK, @Anno1 WHITE
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
@file:kotlin.jvm.JvmName("AnnotationsTest")
|
||||
package test
|
||||
|
||||
@@ -29,4 +31,4 @@ val @receiver:Anno("top-level-val-receiver") Int.topLevelVal: String
|
||||
@Anno("enum")
|
||||
enum class Enum @Anno("enum-constructor") constructor(@Anno("x") val x: Int) {
|
||||
@Anno("white") WHITE(1), @Anno("black") BLACK(2)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// WITH_STDLIB
|
||||
|
||||
interface Parceler<T>
|
||||
@@ -15,4 +16,4 @@ class B
|
||||
class C
|
||||
|
||||
object BParceler : Parceler<B>
|
||||
object CParceler : Parceler<C>
|
||||
object CParceler : Parceler<C>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
//FILE: lib/R.java
|
||||
package lib;
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
@Target(AnnotationTarget.FIELD)
|
||||
annotation class FieldAnno
|
||||
|
||||
@@ -20,4 +22,4 @@ class Baz {
|
||||
@FieldAnno @Anno
|
||||
@JvmField
|
||||
val a: String = ""
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// CORRECT_ERROR_TYPES
|
||||
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
/** Test. */
|
||||
class Test {
|
||||
@@ -64,4 +65,4 @@ enum class EnumError {
|
||||
/**
|
||||
* `/* Failure */`
|
||||
*/
|
||||
interface TestComponent
|
||||
interface TestComponent
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// !KEEP_KDOC_COMMENTS_IN_STUBS
|
||||
/** Test. */
|
||||
class Test {
|
||||
@@ -64,4 +65,4 @@ enum class EnumError {
|
||||
/**
|
||||
* `/* Failure */`
|
||||
*/
|
||||
interface TestComponent
|
||||
interface TestComponent
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
class Привет
|
||||
class République
|
||||
class République
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
data class User(val firstName: String, val secondName: String, val age: Int) {
|
||||
fun procedure() {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
interface IntfWithoutDefaultImpls
|
||||
|
||||
interface IntfWithDefaultImpls {
|
||||
@@ -12,4 +14,4 @@ interface Intf {
|
||||
|
||||
val color: Int
|
||||
get() = BLACK
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// STRICT
|
||||
|
||||
//FILE: test/ClassRefAnnotation.java
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// CORRECT_ERROR_TYPES
|
||||
// STRICT
|
||||
|
||||
|
||||
+3
-1
@@ -1,3 +1,5 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
class Foo(
|
||||
val z: Boolean = true,
|
||||
val b: Byte = 0.toByte(),
|
||||
@@ -26,4 +28,4 @@ class Foo(
|
||||
|
||||
enum class Em {
|
||||
FOO, BAR
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// DUMP_DEFAULT_PARAMETER_VALUES
|
||||
|
||||
class Foo(
|
||||
@@ -25,4 +26,4 @@ class Foo(
|
||||
|
||||
enum class Em {
|
||||
FOO, BAR
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// CORRECT_ERROR_TYPES
|
||||
|
||||
@file:Suppress("UNRESOLVED_REFERENCE")
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
package deprecated
|
||||
|
||||
@Deprecated("Deprecated annotation")
|
||||
@@ -15,4 +17,4 @@ class Foo {
|
||||
var foo: Int
|
||||
@Deprecated("Deprecated getter") get() = 0
|
||||
@Deprecated("Deprecated setter") set(value) {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// CORRECT_ERROR_TYPES
|
||||
|
||||
package kapt
|
||||
@@ -9,4 +10,4 @@ import kotlin.annotation.Repeatable
|
||||
|
||||
enum class Options {
|
||||
A, B, C
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
class Test {
|
||||
private val foo = Example.FOO
|
||||
|
||||
@@ -42,4 +44,4 @@ class Test5 {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
enum class Enum1 {
|
||||
BLACK, WHITE
|
||||
}
|
||||
@@ -20,4 +22,4 @@ enum class Nested1 {
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// CORRECT_ERROR_TYPES
|
||||
|
||||
@file:Suppress("UNRESOLVED_REFERENCE", "ANNOTATION_ARGUMENT_MUST_BE_CONST", "NON_CONST_VAL_USED_IN_CONSTANT_EXPRESSION")
|
||||
@@ -27,6 +28,6 @@ class ErrorInDeclarations {
|
||||
|
||||
annotation class Anno(val a: KClass<Any>)
|
||||
|
||||
// EXPECTED_ERROR(kotlin:11:1) cannot find symbol
|
||||
// EXPECTED_ERROR(kotlin:6:1) cannot find symbol
|
||||
// EXPECTED_ERROR(kotlin:12:1) cannot find symbol
|
||||
// EXPECTED_ERROR(kotlin:7:1) cannot find symbol
|
||||
// EXPECTED_ERROR(kotlin:13:1) cannot find symbol
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
package test
|
||||
|
||||
internal annotation class Anno
|
||||
|
||||
@Anno
|
||||
@Suppress("UNRESOLVED_REFERENCE")
|
||||
internal class ClassWithParent: Foo(), Bar, Baz, CharSequence
|
||||
internal class ClassWithParent: Foo(), Bar, Baz, CharSequence
|
||||
|
||||
+2
-1
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// CORRECT_ERROR_TYPES
|
||||
// NO_VALIDATION
|
||||
// WITH_STDLIB
|
||||
@@ -52,4 +53,4 @@ class MappedList<R>() : AbstractList<R>(), List<R> {
|
||||
|
||||
interface Parent<A : CharSequence?, B>
|
||||
|
||||
class Child : AbstractList<String>(), Parent<String, Int>, List<String>
|
||||
class Child : AbstractList<String>(), Parent<String, Int>, List<String>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// WITH_STDLIB
|
||||
|
||||
@file:JvmName("FacadeName")
|
||||
@@ -5,4 +6,4 @@ package a.b.c
|
||||
|
||||
fun foo() {}
|
||||
|
||||
const val bar = 3
|
||||
const val bar = 3
|
||||
|
||||
@@ -3,4 +3,4 @@ class FunctionsTest {
|
||||
fun f2() = fun (a: Int, b: Int) = a > b
|
||||
fun f3() = run {}
|
||||
fun f4() = run { 3 }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// CORRECT_ERROR_TYPES
|
||||
// WITH_STDLIB
|
||||
|
||||
class MappedList<out T, R>(val list: List<T>, private val function: (T) -> R) : AbstractList<R>(), List<R> {
|
||||
override fun get(index: Int) = function(list[index])
|
||||
override val size get() = list.size
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
class GenericRawSignatures {
|
||||
fun <T> genericFun(): T? = null
|
||||
fun nonGenericFun(): String? = null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,4 +12,4 @@ class MyClass<M1, M2> : Intf<Any, java.util.Date>, OtherIntf<String>, BaseClass<
|
||||
interface ABC {
|
||||
fun <T : CharSequence> abc(item: T, items: List<T>, vararg otherItems: T): List<T>
|
||||
fun <X> bcd(vararg a: Char): Int
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
import kotlinx.kapt.*
|
||||
|
||||
class Test {
|
||||
@@ -10,4 +12,4 @@ class Test {
|
||||
fun nonIgnoredFun() {}
|
||||
|
||||
val nonIgnoredProperty: String = ""
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// WITH_STDLIB
|
||||
|
||||
// FILE: lib/Prop.java
|
||||
@@ -34,4 +35,4 @@ val TESTS_LIST = listOf(object : Prop<Cl>() {
|
||||
override fun set(key: Cl, value: Int) {
|
||||
key.name = " ".repeat(value)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// CORRECT_ERROR_TYPES
|
||||
|
||||
import java.util.concurrent.*
|
||||
@@ -9,4 +10,4 @@ import java.util.Calendar.*
|
||||
|
||||
fun test(): Any? {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// CORRECT_ERROR_TYPES
|
||||
|
||||
// FILE: a.kt
|
||||
@@ -52,4 +53,4 @@ interface TestC {
|
||||
fun e(): LibFooBar
|
||||
}
|
||||
|
||||
// EXPECTED_ERROR(kotlin:17:5) cannot find symbol
|
||||
// EXPECTED_ERROR(kotlin:17:5) cannot find symbol
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
class HomeFragment {
|
||||
@Suppress("TOO_MANY_ARGUMENTS", "DELEGATE_SPECIAL_FUNCTION_MISSING")
|
||||
private val categoryNewsListPresenter by moxyPresenter {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
interface Context
|
||||
|
||||
enum class Result {
|
||||
@@ -10,4 +12,4 @@ abstract class BaseClass(context: Context, num: Int, bool: Boolean) {
|
||||
|
||||
class Inheritor(context: Context) : BaseClass(context, 5, true) {
|
||||
override fun doJob() = Result.SUCCESS
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +1,3 @@
|
||||
inline class Cl(val a: String)
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
inline class Cl(val a: String)
|
||||
|
||||
+3
-1
@@ -1,3 +1,5 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
class Test {
|
||||
private var a = FilterValueDelegate<Float>()
|
||||
private inner class FilterValueDelegate<T>
|
||||
@@ -13,4 +15,4 @@ class Test2 {
|
||||
class Test3 {
|
||||
private var a = FilterValueDelegate<Float>()
|
||||
private class FilterValueDelegate<T>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
interface Named {
|
||||
val name: String?
|
||||
}
|
||||
@@ -8,4 +10,4 @@ class Product2 : Named {
|
||||
constructor(otherName: String) {
|
||||
this.name = otherName
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
enum class Color {
|
||||
BLACK, `WHI-TE`
|
||||
}
|
||||
@@ -5,5 +7,5 @@ enum class Color {
|
||||
@Anno(Color.`WHI-TE`)
|
||||
annotation class Anno(val color: Color)
|
||||
|
||||
// EXPECTED_ERROR(kotlin:5:1) an enum annotation value must be an enum constant
|
||||
// EXPECTED_ERROR(kotlin:7:1) an enum annotation value must be an enum constant
|
||||
// EXPECTED_ERROR(other:-1:-1) 'WHI-TE' is an invalid Java enum value name
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class default {
|
||||
lateinit val extends: String
|
||||
fun implements(instanceof: Int) {}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -16,4 +16,4 @@ class D
|
||||
|
||||
// FILE: e.kt
|
||||
package a.b.`typealias`.c
|
||||
class E
|
||||
class E
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
package javadoc
|
||||
|
||||
/** Simple */
|
||||
@@ -32,4 +34,4 @@ class B {
|
||||
stars
|
||||
*/
|
||||
val d = ""
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// !JVM_DEFAULT_MODE: all
|
||||
|
||||
interface Foo {
|
||||
@@ -10,4 +11,4 @@ interface Foo {
|
||||
}
|
||||
|
||||
fun bar()
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// !JVM_DEFAULT_MODE: all-compatibility
|
||||
|
||||
interface Foo {
|
||||
@@ -10,4 +11,4 @@ interface Foo {
|
||||
}
|
||||
|
||||
fun bar()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// !JVM_DEFAULT_MODE: disable
|
||||
|
||||
interface Foo {
|
||||
@@ -11,4 +12,4 @@ interface Foo {
|
||||
}
|
||||
|
||||
fun bar()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// !JVM_DEFAULT_MODE: enable
|
||||
|
||||
interface Foo {
|
||||
@@ -11,4 +12,4 @@ interface Foo {
|
||||
}
|
||||
|
||||
fun bar()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
class State @JvmOverloads constructor(
|
||||
val someInt: Int,
|
||||
val someLong: Long,
|
||||
@@ -14,4 +16,4 @@ class State2 @JvmOverloads constructor(
|
||||
|
||||
fun someMethod(str: String) {}
|
||||
fun methodWithoutArgs() {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
class JvmStaticTest {
|
||||
companion object {
|
||||
@JvmStatic
|
||||
@@ -17,4 +19,4 @@ interface FooComponent {
|
||||
@JvmStatic
|
||||
fun create(context: String): String = "foo"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
class Test {
|
||||
companion object A {
|
||||
@JvmStatic
|
||||
val test: String = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
fun crashMe(values: List<String>): String {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
|
||||
fun crashMe(values: List<CharSequence>): CharSequence {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// WITH_STDLIB
|
||||
@file:Suppress("AMBIGUOUS_ANONYMOUS_TYPE_INFERRED")
|
||||
|
||||
@@ -32,4 +33,4 @@ fun e() = arrayOf(object : Runnable {
|
||||
fun e1(a: Array<CharSequence>) {}
|
||||
fun e2(a: Array<in CharSequence>) {}
|
||||
fun e3(a: Array<out CharSequence>) {}
|
||||
fun e3(a: Array<*>) {}
|
||||
fun e3(a: Array<*>) {}
|
||||
|
||||
@@ -7,4 +7,4 @@ class Outer {
|
||||
}
|
||||
|
||||
abstract fun abstract(s: String, i: Int)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
interface MyInterface {
|
||||
fun someFun()
|
||||
private class MyDefaultInferface()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
package test
|
||||
|
||||
internal class MutableEntry<K, V>(
|
||||
private val internal: MutableMap<K, V>,
|
||||
override val key: K, value: V
|
||||
): MutableMap.MutableEntry<K, V>
|
||||
): MutableMap.MutableEntry<K, V>
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
import java.util.Date
|
||||
|
||||
fun Date(double: Double): Date = Date(double.times(1000).toLong())
|
||||
fun Date(double: Double): Date = Date(double.times(1000).toLong())
|
||||
|
||||
@@ -22,4 +22,4 @@ fun test4() = (0..10).map { n ->
|
||||
object : Foo(), Runnable {
|
||||
override fun run() {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
package test
|
||||
|
||||
class Test<T : CharSequence, N : Number> {
|
||||
@@ -8,4 +10,4 @@ class Test<T : CharSequence, N : Number> {
|
||||
|
||||
interface ListUpdateCallback {
|
||||
fun onInserted(position: Int, count: Int)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
package test
|
||||
|
||||
class Test<T : CharSequence, N : Number> {
|
||||
@@ -8,4 +10,4 @@ class Test<T : CharSequence, N : Number> {
|
||||
|
||||
interface TypedListUpdateCallback<T : Any, C : Number> {
|
||||
fun onInserted(position: C, count: C, item: T)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// STRICT
|
||||
|
||||
class Foo(private val string: String) {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// CORRECT_ERROR_TYPES
|
||||
|
||||
// FILE: kapt/StaticMethod.java
|
||||
@@ -40,4 +41,4 @@ class StaticImport {
|
||||
val l = of("hello", "world")
|
||||
val m = of2("hello")
|
||||
val y = "1".func()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// WITH_STDLIB
|
||||
|
||||
@file:Suppress("NOTHING_TO_INLINE")
|
||||
@@ -37,4 +38,4 @@ abstract class BundleProperty<AA>(key: String?) : NullableBundleProperty<AA>(key
|
||||
}
|
||||
|
||||
abstract fun setValue(bundle: Any, key: String, value: AA)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// CORRECT_ERROR_TYPES
|
||||
|
||||
package foo
|
||||
@@ -6,4 +7,4 @@ interface InterfaceWithDefaults<T> {
|
||||
fun foo() {}
|
||||
}
|
||||
|
||||
interface SubInterface<T> : InterfaceWithDefaults<T>
|
||||
interface SubInterface<T> : InterfaceWithDefaults<T>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// CORRECT_ERROR_TYPES
|
||||
|
||||
@file:Suppress("UNRESOLVED_REFERENCE", "ANNOTATION_ARGUMENT_MUST_BE_CONST")
|
||||
@@ -14,6 +15,6 @@ class ErrorSomeMissingAnnotations
|
||||
|
||||
annotation class Anno(val klass: KClass<*>)
|
||||
|
||||
// EXPECTED_ERROR(kotlin:12:1) cannot find symbol
|
||||
// EXPECTED_ERROR(kotlin:6:1) cannot find symbol
|
||||
// EXPECTED_ERROR(kotlin:9:1) cannot find symbol
|
||||
// EXPECTED_ERROR(kotlin:10:1) cannot find symbol
|
||||
// EXPECTED_ERROR(kotlin:13:1) cannot find symbol
|
||||
// EXPECTED_ERROR(kotlin:7:1) cannot find symbol
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
class T : Runnable {
|
||||
@Override
|
||||
public override fun run() {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// WITH_STDLIB
|
||||
|
||||
interface Intf
|
||||
|
||||
@@ -16,4 +16,4 @@ package test
|
||||
|
||||
fun test(a: `$Test`.`$Inner`) {}
|
||||
|
||||
fun test(a: `Test$`.`Inner$`) {}
|
||||
fun test(a: `Test$`.`Inner$`) {}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// CORRECT_ERROR_TYPES
|
||||
|
||||
// FILE: te/st/a/JavaClass
|
||||
@@ -13,4 +14,4 @@ import te.st.a.`$Test`.Inner as MyInner
|
||||
import te.st.a.`Test$`.Inner as MyInner2
|
||||
import te.st.a.`Test$`.`Inner$` as MyInner3
|
||||
|
||||
fun a(a: MyInner) {}
|
||||
fun a(a: MyInner) {}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
interface EntryHolder {
|
||||
fun entry(p: Map.Entry<CharSequence, Map.Entry<String, Int>>): Map.Entry<String, Any>
|
||||
val entryProperty: Map.Entry<String, Any>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// CORRECT_ERROR_TYPES
|
||||
// JAVAC_OPTION -Xmaxerrs=1
|
||||
|
||||
@@ -11,4 +12,4 @@ class Test {
|
||||
// There are two errors (unresolved identifier ABC, BCD) actually.
|
||||
// But we specified the max error count, so the error output is limited.
|
||||
|
||||
// EXPECTED_ERROR(kotlin:8:5) cannot find symbol
|
||||
// EXPECTED_ERROR(kotlin:8:5) cannot find symbol
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
interface Intf {
|
||||
fun foo(abc: String)
|
||||
|
||||
@@ -12,4 +14,4 @@ abstract class Cls {
|
||||
fun bar(bcd: Int): String {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -1,7 +1,9 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
class CrashMe {
|
||||
val resources = 1
|
||||
|
||||
fun getResources(): String {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
package modifiers
|
||||
|
||||
public class PublicClass public constructor()
|
||||
@@ -34,4 +36,4 @@ class Modifiers {
|
||||
|
||||
@JvmOverloads
|
||||
fun overloads(a: String = "", n: Int = 5): String = null!!
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// WITH_STDLIB
|
||||
|
||||
// FILE: a.kt
|
||||
@@ -19,4 +20,4 @@ fun bar() {}
|
||||
@file:JvmName("M2")
|
||||
package test
|
||||
|
||||
fun baz() {}
|
||||
fun baz() {}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
class Test {
|
||||
class Nested {
|
||||
class NestedNested
|
||||
@@ -55,4 +57,4 @@ class A2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// FILE: JavaClass.java
|
||||
public class JavaClass {
|
||||
public class Foo {
|
||||
@@ -78,4 +79,4 @@ class Test1(val zoo: Foo.Bar.Zoo) : Foo.Bar(), IFoo.IBar, IFoo.IBar.IZoo {
|
||||
}
|
||||
|
||||
// EXPECTED_ERROR class J$B is public, should be declared in a file named J$B.java
|
||||
// EXPECTED_ERROR class JavaClass is public, should be declared in a file named JavaClass.java
|
||||
// EXPECTED_ERROR class JavaClass is public, should be declared in a file named JavaClass.java
|
||||
|
||||
+2
-1
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// FILE: test/JavaClass.java
|
||||
package test;
|
||||
|
||||
@@ -83,4 +84,4 @@ class Test1(val zoo: Foo.Bar.Zoo) : Foo.Bar(), IFoo.IBar, IFoo.IBar.IZoo {
|
||||
fun b(foo: JavaClass.Foo, bar: JavaClass.Foo.Bar) {}
|
||||
}
|
||||
|
||||
// EXPECTED_ERROR class J$B is public, should be declared in a file named J$B.java
|
||||
// EXPECTED_ERROR class J$B is public, should be declared in a file named J$B.java
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// CORRECT_ERROR_TYPES
|
||||
// NON_EXISTENT_CLASS
|
||||
// NO_VALIDATION
|
||||
|
||||
+2
-1
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// CORRECT_ERROR_TYPES
|
||||
// NON_EXISTENT_CLASS
|
||||
// NO_VALIDATION
|
||||
@@ -63,4 +64,4 @@ class Test<G> {
|
||||
|
||||
class MyType<T>
|
||||
|
||||
annotation class Anno(val a: KClass<*>, val b: Array<KClass<*>>, val c: Array<KClass<*>>, vararg val d: KClass<*>)
|
||||
annotation class Anno(val a: KClass<*>, val b: Array<KClass<*>>, val c: Array<KClass<*>>, vararg val d: KClass<*>)
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// NON_EXISTENT_CLASS
|
||||
// NO_VALIDATION
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
object PrimitiveTypes {
|
||||
const val booleanFalse: Boolean = false
|
||||
const val booleanTrue: Boolean = true
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
class Test {
|
||||
val simple: String = "123"
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
annotation class Anno
|
||||
|
||||
@Target(AnnotationTarget.PROPERTY, AnnotationTarget.CLASS)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// FILE: androidx/annotation/RecentlyNullable.java
|
||||
package androidx.annotation;
|
||||
|
||||
@@ -20,4 +21,4 @@ package app
|
||||
|
||||
import androidx.annotation.Box
|
||||
|
||||
class KBox(val delegate: Box) : Box by delegate
|
||||
class KBox(val delegate: Box) : Box by delegate
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// FILE: lib/Anno.java
|
||||
package lib;
|
||||
public @interface Anno {
|
||||
@@ -55,4 +56,4 @@ annotation class AnnoEnum(val x: Int, val c: Color)
|
||||
@AnnoLongArray(lib.R.id.textView, [1L, 3L])
|
||||
@AnnoArray(lib.R.id.textView, [ "A", "B" ])
|
||||
@AnnoClass(lib.R.id.textView, Color::class)
|
||||
class Test2
|
||||
class Test2
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// CORRECT_ERROR_TYPES
|
||||
|
||||
package secondary
|
||||
@@ -12,4 +13,4 @@ class Product2 : Named {
|
||||
constructor(otherName: String) {
|
||||
this.name = otherName
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,4 +6,4 @@ fun foo() {}
|
||||
// FILE: b.kt
|
||||
package test
|
||||
|
||||
fun bar() {}
|
||||
fun bar() {}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
class `:)` {
|
||||
lateinit val f: String
|
||||
}
|
||||
@@ -37,4 +39,4 @@ class `A B` {
|
||||
class C
|
||||
}
|
||||
|
||||
// EXPECTED_ERROR(other:-1:-1) '60x60' is an invalid Java enum value name
|
||||
// EXPECTED_ERROR(other:-1:-1) '60x60' is an invalid Java enum value name
|
||||
|
||||
@@ -9,4 +9,4 @@ class `My $ name` {
|
||||
|
||||
// japanese hiragana
|
||||
fun `こ と り ん!`() {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// STRIP_METADATA
|
||||
|
||||
interface Context
|
||||
@@ -12,4 +13,4 @@ abstract class BaseClass(context: Context, num: Int, bool: Boolean) {
|
||||
|
||||
class Inheritor(context: Context) : BaseClass(context, 5, true) {
|
||||
override fun doJob() = Result.SUCCESS
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
open class Test {
|
||||
|
||||
open fun getTestNoSuspend(text: String): String {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// CORRECT_ERROR_TYPES
|
||||
// NO_VALIDATION
|
||||
// WITH_STDLIB
|
||||
@@ -7,4 +8,4 @@ class Foo {
|
||||
suspend fun a(): ABC = TODO()
|
||||
|
||||
suspend fun b(): Result<ABC> = TODO()
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user