wjur
10/26/2020, 8:56 PMkotlin.reflect
and I want to contribute. I did some research and here’s what I found. Calling metod.kotlinFunction
on a method that is a suspend function with inline class as a return type results in an error. It happens exactly in InlineClassAwareCaller.kt#L100. It is similar to KT-34024 , but it’s not exactly it.
I went through the code and now I have a working minimal setup that reproduces the problem and some ideas how to fix it. I’d like to apply my ideas, starting with writing failing tests. I tried to find out how to write one, but I couldn’t find any instructions for that. I checked what git-blame says about the file and I found a commit which modifies the code and adds some tests. The commit adds, for example, compiler/testData/codegen/box/reflection/callBy/inlineClassDefaultArguments.kt, and, in the beginning of the file, there is:
// IGNORE_BACKEND: JS_IR, JS, NATIVE
// WITH_REFLECT
I found another one with:
// TARGET_BACKEND: JVM
// WITH_REFLECT
// WITH_COROUTINES
They seem to be instructions for a tool used in tests. Do you have any manual for it? Eg what options are available?
Is it a good idea if I try to mimic what the linked commit does? I mean, is it sufficient to add *.kt file in the compile/testData/codegen directory and call ./gradlew coreLibTests
?
Thank you :)udalov
generateTests
Gradle task. You can simply add a test file (in this case, to compiler/testData/codegen/box/reflection/...
) and regenerate tests, after which you’ll see a bunch of new tests added. The main one of those would be in BlackBoxCodegenTestGenerated
, this is the (old) JVM backend used in Kotlin 1.4. Other tests are checking other parts of the compiler, which you can see by their names (new frontend, JS backends, etc.). For JVM-specific reflection tests, you need to have TARGET_BACKEND: JVM
and WITH_REFLECT
directives.udalov
BlackBoxCodegenTestGenerated.Reflection
.wjur
10/27/2020, 1:38 PMwjur
10/27/2020, 1:38 PMudalov
wjur
11/05/2020, 1:41 PM