Add ANDROID target
This commit is contained in:
+32
-9
@@ -17,7 +17,6 @@
|
||||
package org.jetbrains.kotlin.android.tests
|
||||
|
||||
import com.intellij.openapi.util.Ref
|
||||
import org.jetbrains.kotlin.codegen.CodegenTestCase
|
||||
import org.jetbrains.kotlin.load.kotlin.PackagePartClassUtils
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
@@ -47,18 +46,21 @@ internal fun patchFilesAndAddTest(
|
||||
|
||||
val newPackagePrefix = testFile.path.replace("\\\\|-|\\.|/".toRegex(), "_")
|
||||
val oldPackage = Ref<FqName>()
|
||||
val isJvmName = Ref<Boolean>(false)
|
||||
val isSingle = testFiles.size == 1
|
||||
val resultFiles = testFiles.map {
|
||||
val fileName = if (isSingle) it.name else testFile.name.substringBeforeLast(".kt") + "/" + it.name
|
||||
TestClassInfo(
|
||||
fileName,
|
||||
changePackage(newPackagePrefix, it.content, oldPackage),
|
||||
changePackage(newPackagePrefix, it.content, oldPackage, isJvmName),
|
||||
oldPackage.get(),
|
||||
isJvmName.get(),
|
||||
getGeneratedClassName(File(fileName), it.content, newPackagePrefix, oldPackage.get())
|
||||
)
|
||||
}
|
||||
val packages =
|
||||
resultFiles.map { OldPackageAndNew(it.oldPackage, it.newClassId.parent()) }.sortedByDescending { it.oldFqName.asString().length }
|
||||
resultFiles.map { OldPackageAndNew(it.oldPackage, it.newPackagePartClassId.parent()) }
|
||||
.sortedByDescending { it.oldFqName.asString().length }
|
||||
|
||||
//If files contain any val or var declaration with same name as any package name
|
||||
// then use old conservative renaming scheme, otherwise use aggressive one
|
||||
@@ -95,7 +97,7 @@ internal fun patchFilesAndAddTest(
|
||||
/*replace all Class.forName*/
|
||||
resultFiles.forEach { file ->
|
||||
file.content = resultFiles.fold(file.content) { r, param ->
|
||||
patchClassForName(param.newClassId, param.oldPackage, r, conservativeRenameScheme)
|
||||
patchClassForName(param.newPackagePartClassId, param.oldPackage, r, conservativeRenameScheme)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,6 +106,13 @@ internal fun patchFilesAndAddTest(
|
||||
file.content = file.content.patchSelfImports(file.newPackage)
|
||||
}
|
||||
|
||||
//patch root package parts usages in strings
|
||||
resultFiles.forEach { file ->
|
||||
file.content = resultFiles.fold(file.content) { r, param ->
|
||||
patchRootPartNamesInStrings(param.newPackagePartClassId, param.oldPackage, param.isJvmName, r)
|
||||
}
|
||||
}
|
||||
|
||||
val boxFiles = resultFiles.filter { hasBoxMethod(it.content) }
|
||||
if (boxFiles.size != 1) {
|
||||
println("Several box methods in $testFile")
|
||||
@@ -111,22 +120,22 @@ internal fun patchFilesAndAddTest(
|
||||
|
||||
filesHolder.addTest(
|
||||
resultFiles.filter { resultFile -> resultFile.name.endsWith(".kt") || resultFile.name.endsWith(".kts") },
|
||||
TestInfo("", boxFiles.last().newClassId, testFile)
|
||||
TestInfo("", boxFiles.last().newPackagePartClassId, testFile)
|
||||
)
|
||||
|
||||
return boxFiles.last().newClassId
|
||||
return boxFiles.last().newPackagePartClassId
|
||||
}
|
||||
|
||||
private fun hasBoxMethod(text: String): Boolean {
|
||||
return text.contains("fun box()")
|
||||
}
|
||||
|
||||
class TestClassInfo(val name: String, var content: String, val oldPackage: FqName, val newClassId: FqName) {
|
||||
val newPackage = newClassId.parent()
|
||||
class TestClassInfo(val name: String, var content: String, val oldPackage: FqName, val isJvmName: Boolean, val newPackagePartClassId: FqName) {
|
||||
val newPackage = newPackagePartClassId.parent()
|
||||
}
|
||||
|
||||
|
||||
private fun changePackage(newPackagePrefix: String, text: String, oldPackage: Ref<FqName>): String {
|
||||
private fun changePackage(newPackagePrefix: String, text: String, oldPackage: Ref<FqName>, isJvmName: Ref<Boolean>): String {
|
||||
val matcher = packagePattern.matcher(text)
|
||||
if (matcher.find()) {
|
||||
val oldPackageName = matcher.toMatchResult().group(1)
|
||||
@@ -138,6 +147,7 @@ private fun changePackage(newPackagePrefix: String, text: String, oldPackage: Re
|
||||
if (text.contains("@file:")) {
|
||||
val index = text.lastIndexOf("@file:")
|
||||
val packageDirectiveIndex = text.indexOf("\n", index)
|
||||
isJvmName.set(true)
|
||||
return text.substring(0, packageDirectiveIndex + 1) + packageDirective + text.substring(packageDirectiveIndex + 1)
|
||||
} else {
|
||||
return packageDirective + text
|
||||
@@ -170,6 +180,19 @@ private fun patchClassForName(className: FqName, oldPackage: FqName, text: Strin
|
||||
)
|
||||
}
|
||||
|
||||
private fun patchRootPartNamesInStrings(
|
||||
className: FqName,
|
||||
oldPackage: FqName,
|
||||
isJvmName: Boolean,
|
||||
text: String
|
||||
): String {
|
||||
if (!oldPackage.isRoot || isJvmName) return text
|
||||
return text.replace(
|
||||
("\"" + oldPackage.child(className.shortName()).asString()).toRegex(),
|
||||
"\"" + className.asString()
|
||||
)
|
||||
}
|
||||
|
||||
private fun patchPackages(newPackage: FqName, oldPackage: FqName, text: String): String {
|
||||
if (oldPackage.isRoot) return text
|
||||
|
||||
|
||||
+5
-14
@@ -246,9 +246,6 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
|
||||
}
|
||||
|
||||
for (file in files) {
|
||||
if (SpecialFiles.getExcludedFiles().contains(file.name)) {
|
||||
continue
|
||||
}
|
||||
if (file.isDirectory) {
|
||||
val listFiles = file.listFiles()
|
||||
if (listFiles != null) {
|
||||
@@ -261,7 +258,9 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
|
||||
continue
|
||||
}
|
||||
|
||||
if (!InTextDirectivesUtils.isPassingTarget(TargetBackend.JVM, file)) {
|
||||
if (!InTextDirectivesUtils.isPassingTarget(TargetBackend.JVM, file) ||
|
||||
InTextDirectivesUtils.isIgnoredTarget(TargetBackend.ANDROID, file)
|
||||
) {
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -313,16 +312,7 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
|
||||
}
|
||||
|
||||
private fun createTestFiles(file: File, expectedText: String): List<KotlinBaseTest.TestFile> =
|
||||
TestFiles.createTestFiles(
|
||||
file.name,
|
||||
expectedText,
|
||||
object : TestFiles.TestFileFactoryNoModules<KotlinBaseTest.TestFile>() {
|
||||
override fun create(fileName: String, text: String, directives: Directives): KotlinBaseTest.TestFile {
|
||||
return KotlinBaseTest.TestFile(fileName, text, directives)
|
||||
}
|
||||
}, false,
|
||||
"kotlin.coroutines"
|
||||
)
|
||||
CodegenTestCase.createTestFilesFromFile(file, expectedText, "kotlin.coroutines", false, TargetBackend.JVM)
|
||||
|
||||
companion object {
|
||||
const val GRADLE_VERSION = "5.6.4"
|
||||
@@ -359,6 +349,7 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
|
||||
val rootFolder = File("")
|
||||
val pathManager = PathManager(rootFolder.absolutePath, tmpFolder.absolutePath)
|
||||
generate(pathManager, true)
|
||||
println("Android test project is generated into " + tmpFolder.absolutePath + " folder")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.android.tests;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class SpecialFiles {
|
||||
private static final Set<String> excludedFiles = new HashSet<>();
|
||||
|
||||
static {
|
||||
fillExcludedFiles();
|
||||
}
|
||||
|
||||
public static Set<String> getExcludedFiles() {
|
||||
return excludedFiles;
|
||||
}
|
||||
|
||||
private static void fillExcludedFiles() {
|
||||
// Reflection
|
||||
excludedFiles.add("enclosing");
|
||||
excludedFiles.add("kt10259.kt");
|
||||
excludedFiles.add("simpleClassLiteral.kt");
|
||||
|
||||
//UnsatisfiedLinkError
|
||||
excludedFiles.add("nativePropertyAccessors.kt");
|
||||
excludedFiles.add("topLevel.kt");
|
||||
|
||||
// "IOOBE: Invalid index 4, size is 4" for java.lang.reflect.ParameterizedType on Android
|
||||
excludedFiles.add("innerGenericTypeArgument.kt");
|
||||
|
||||
// Cannot change package name
|
||||
excludedFiles.add("kt6990.kt");
|
||||
excludedFiles.add("typeParameters.kt");
|
||||
excludedFiles.add("kt13133.kt");
|
||||
|
||||
// StackOverflow with StringBuilder (escape())
|
||||
excludedFiles.add("kt684.kt");
|
||||
|
||||
// Wrong enclosing info or signature after package renaming
|
||||
excludedFiles.add("enclosingInfo");
|
||||
excludedFiles.add("signature");
|
||||
|
||||
// Some classes are not visible on android
|
||||
excludedFiles.add("classpath.kt");
|
||||
|
||||
// Out of memory
|
||||
excludedFiles.add("manyNumbers.kt");
|
||||
|
||||
// Native methods
|
||||
excludedFiles.add("external");
|
||||
|
||||
// Additional nested class in 'Thread' class on Android
|
||||
excludedFiles.add("nestedClasses.kt");
|
||||
|
||||
// KT-8120
|
||||
excludedFiles.add("closureOfInnerLocalClass.kt");
|
||||
excludedFiles.add("closureWithSelfInstantiation.kt");
|
||||
excludedFiles.add("quotedClassName.kt");
|
||||
|
||||
//wrong function resolution after package renaming
|
||||
excludedFiles.add("apiVersionAtLeast1.kt");
|
||||
|
||||
//special symbols in names
|
||||
excludedFiles.add("nameWithWhitespace.kt");
|
||||
|
||||
//some classes are moved from stdlib to compatibility package
|
||||
excludedFiles.add("suspendFunction_1_2.kt");
|
||||
}
|
||||
|
||||
private SpecialFiles() {
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@
|
||||
// Therefore, do not attemp to dex this file as it will fail.
|
||||
// See: https://source.android.com/devices/tech/dalvik/dex-format#simplename
|
||||
// IGNORE_DEXING
|
||||
// IGNORE_BACKEND: ANDROID
|
||||
|
||||
class `A!u00A0`() {
|
||||
val ok = "OK"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: ANDROID
|
||||
|
||||
// WITH_RUNTIME
|
||||
// FULL_JDK
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: ANDROID
|
||||
|
||||
// WITH_RUNTIME
|
||||
// FULL_JDK
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: ANDROID
|
||||
|
||||
// WITH_RUNTIME
|
||||
// FULL_JDK
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: ANDROID
|
||||
|
||||
// FULL_JDK
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: ANDROID
|
||||
|
||||
// FULL_JDK
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: ANDROID
|
||||
|
||||
// FULL_JDK
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
// Out of memory on Android 4.4
|
||||
// IGNORE_BACKEND: ANDROID
|
||||
|
||||
// WITH_REFLECT
|
||||
|
||||
import java.util.*
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
//
|
||||
// See: https://source.android.com/devices/tech/dalvik/dex-format#simplename
|
||||
// IGNORE_DEXING
|
||||
// IGNORE_BACKEND: ANDROID
|
||||
|
||||
fun `method with spaces`(): String {
|
||||
data class C(val s: String = "OK")
|
||||
|
||||
+3
@@ -4,6 +4,9 @@
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
|
||||
// some classes are moved from stdlib to compatibility package
|
||||
// IGNORE_BACKEND: ANDROID
|
||||
|
||||
import helpers.*
|
||||
import kotlin.coroutines.*
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
// l[0] === 1000 is true on Android
|
||||
// IGNORE_BACKEND: ANDROID
|
||||
|
||||
fun box(): String {
|
||||
val l = java.util.ArrayList<Int>()
|
||||
l.add(1000)
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS, NATIVE
|
||||
|
||||
// StackOverflow with StringBuilder (escape()) on Android 4.4
|
||||
// IGNORE_BACKEND: ANDROID
|
||||
|
||||
fun escapeChar(c : Char) : String? = when (c) {
|
||||
'\\' -> "\\\\"
|
||||
'\n' -> "\\n"
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
// WITH_REFLECT
|
||||
// IGNORE_BACKEND: JS_IR, JS, NATIVE
|
||||
|
||||
// different annotation order
|
||||
// IGNORE_BACKEND: ANDROID
|
||||
|
||||
package test
|
||||
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
+2
-1
@@ -1,9 +1,10 @@
|
||||
// IGNORE_BACKEND: NATIVE
|
||||
// WITH_REFLECT
|
||||
package test
|
||||
|
||||
class A
|
||||
|
||||
fun box(): String {
|
||||
val klass = A::class
|
||||
return if (klass.toString() == "class A") "OK" else "Fail: $klass"
|
||||
return if (klass.toString() == "class test.A") "OK" else "Fail: $klass"
|
||||
}
|
||||
|
||||
+3
@@ -1,5 +1,8 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
// has declaring class on Android 4.4
|
||||
// IGNORE_BACKEND: ANDROID
|
||||
|
||||
// WITH_REFLECT
|
||||
|
||||
val property = fun () {}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
// TARGET_BACKEND: JVM
|
||||
package test
|
||||
|
||||
interface Z {
|
||||
private fun privateFun() = { "OK" }
|
||||
@@ -58,7 +59,7 @@ fun box(): String {
|
||||
|
||||
val nested = Z.Nested::class.java
|
||||
val enclosingClass = nested.enclosingClass!!
|
||||
if (enclosingClass.name != "Z") return "fail 9: ${enclosingClass.name}"
|
||||
if (enclosingClass.name != "test.Z") return "fail 9: ${enclosingClass.name}"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
|
||||
+2
-1
@@ -2,6 +2,7 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
// WITH_REFLECT
|
||||
package test
|
||||
|
||||
var lambda = {}
|
||||
|
||||
@@ -20,7 +21,7 @@ fun box(): String {
|
||||
if (enclosingMethod?.getName() != "run") return "method: $enclosingMethod"
|
||||
|
||||
val enclosingClass = javaClass.getEnclosingClass()!!.getName()
|
||||
if (enclosingClass != "A\$prop\$1") return "enclosing class: $enclosingClass"
|
||||
if (enclosingClass != "test.A\$prop\$1") return "enclosing class: $enclosingClass"
|
||||
|
||||
val declaringClass = javaClass.getDeclaringClass()
|
||||
if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass"
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
// WITH_REFLECT
|
||||
// has declaring class on Android 4.4
|
||||
// IGNORE_BACKEND: ANDROID
|
||||
|
||||
// WITH_REFLECT
|
||||
class O {
|
||||
companion object {
|
||||
// Currently we consider <clinit> in class O as the enclosing method of this lambda,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
// WITH_REFLECT
|
||||
package test
|
||||
|
||||
class C {
|
||||
val l: Any = {}
|
||||
@@ -9,10 +10,10 @@ class C {
|
||||
fun box(): String {
|
||||
val javaClass = C().l.javaClass
|
||||
val enclosingConstructor = javaClass.getEnclosingConstructor()
|
||||
if (enclosingConstructor?.getDeclaringClass()?.getName() != "C") return "ctor: $enclosingConstructor"
|
||||
if (enclosingConstructor?.getDeclaringClass()?.getName() != "test.C") return "ctor: $enclosingConstructor"
|
||||
|
||||
val enclosingClass = javaClass.getEnclosingClass()
|
||||
if (enclosingClass?.getName() != "C") return "enclosing class: $enclosingClass"
|
||||
if (enclosingClass?.getName() != "test.C") return "enclosing class: $enclosingClass"
|
||||
|
||||
val declaringClass = javaClass.getDeclaringClass()
|
||||
if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass"
|
||||
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
// WITH_REFLECT
|
||||
package test
|
||||
|
||||
class C {
|
||||
fun foo(): Any {
|
||||
@@ -15,7 +16,7 @@ fun box(): String {
|
||||
if (enclosingMethod?.getName() != "foo") return "method: $enclosingMethod"
|
||||
|
||||
val enclosingClass = javaClass.getEnclosingClass()
|
||||
if (enclosingClass?.getName() != "C") return "enclosing class: $enclosingClass"
|
||||
if (enclosingClass?.getName() != "test.C") return "enclosing class: $enclosingClass"
|
||||
|
||||
val declaringClass = javaClass.getDeclaringClass()
|
||||
if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass"
|
||||
|
||||
+3
@@ -1,5 +1,8 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
// has declaring class on Android 4.4
|
||||
// IGNORE_BACKEND: ANDROID
|
||||
|
||||
// WITH_REFLECT
|
||||
|
||||
object O {
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
// has declaring class on Android 4.4
|
||||
// IGNORE_BACKEND: ANDROID
|
||||
|
||||
// WITH_REFLECT
|
||||
|
||||
val l: Any = {}
|
||||
|
||||
+3
-2
@@ -1,5 +1,6 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
package test
|
||||
|
||||
class C {
|
||||
val f by foo {
|
||||
@@ -19,7 +20,7 @@ fun box(): String {
|
||||
if (emInner?.getName() != "invoke") return "Fail: incorrect enclosing method for inner lambda: $emInner"
|
||||
|
||||
val ecInner = innerLambda.getEnclosingClass()
|
||||
if (ecInner?.getName() != "C\$f\$2") return "Fail: incorrect enclosing class for inner lambda: $ecInner"
|
||||
if (ecInner?.getName() != "test.C\$f\$2") return "Fail: incorrect enclosing class for inner lambda: $ecInner"
|
||||
|
||||
val ectorInner = innerLambda.getEnclosingConstructor()
|
||||
if (ectorInner != null) return "Fail: inner lambda should not have enclosing constructor: $ectorInner"
|
||||
@@ -35,7 +36,7 @@ fun box(): String {
|
||||
if (emOuter != null) return "Fail: outer lambda should not have enclosing method: $emOuter"
|
||||
|
||||
val ecOuter = outerLambda.getEnclosingClass()
|
||||
if (ecOuter?.getName() != "C") return "Fail: incorrect enclosing class for outer lambda: $ecOuter"
|
||||
if (ecOuter?.getName() != "test.C") return "Fail: incorrect enclosing class for outer lambda: $ecOuter"
|
||||
|
||||
val ectorOuter = outerLambda.getEnclosingConstructor()
|
||||
if (ectorOuter == null) return "Fail: outer lambda _should_ have enclosing constructor"
|
||||
|
||||
+3
@@ -1,6 +1,9 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
// "IOOBE: Invalid index 4, size is 4" for java.lang.reflect.ParameterizedType on Android
|
||||
// IGNORE_BACKEND: ANDROID
|
||||
|
||||
// WITH_REFLECT
|
||||
|
||||
import kotlin.reflect.jvm.javaType
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
// !JVM_DEFAULT_MODE: disable
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
// First item on Android is `java.lang.Thread.getStackTrace`
|
||||
// IGNORE_BACKEND: ANDROID
|
||||
|
||||
// WITH_RUNTIME
|
||||
// FULL_JDK
|
||||
|
||||
|
||||
+4
@@ -1,4 +1,8 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
// Wrong function resolution after package renaming
|
||||
// IGNORE_BACKEND: ANDROID
|
||||
|
||||
// FILE: 1.kt
|
||||
package kotlin.internal
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: ANDROID
|
||||
|
||||
// FILE: 1.kt
|
||||
// WITH_REFLECT
|
||||
package test
|
||||
|
||||
@@ -773,16 +773,27 @@ public abstract class CodegenTestCase extends KotlinBaseTest<KotlinBaseTest.Test
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
protected List<TestFile> createTestFilesFromFile(File file, @NotNull String expectedText) {
|
||||
protected List<TestFile> createTestFilesFromFile(@NotNull File file, @NotNull String expectedText) {
|
||||
return createTestFilesFromFile(file, expectedText, coroutinesPackage, parseDirectivesPerFiles(), getBackend());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static List<TestFile> createTestFilesFromFile(
|
||||
@NotNull File file,
|
||||
@NotNull String expectedText,
|
||||
@NotNull String coroutinesPackage,
|
||||
boolean parseDirectivesPerFiles,
|
||||
@NotNull TargetBackend backend
|
||||
) {
|
||||
List testFiles = TestFiles.createTestFiles(file.getName(), expectedText, new TestFiles.TestFileFactoryNoModules<TestFile>() {
|
||||
@NotNull
|
||||
@Override
|
||||
public TestFile create(@NotNull String fileName, @NotNull String text, @NotNull Directives directives) {
|
||||
return new TestFile(fileName, text, directives);
|
||||
}
|
||||
}, false, coroutinesPackage, parseDirectivesPerFiles());
|
||||
}, false, coroutinesPackage, parseDirectivesPerFiles);
|
||||
if (InTextDirectivesUtils.isDirectiveDefined(expectedText, "WITH_HELPERS")) {
|
||||
testFiles.add(new TestFile("CodegenTestHelpers.kt", TestHelperGeneratorKt.createTextForCodegenTestHelpers(getBackend())));
|
||||
testFiles.add(new TestFile("CodegenTestHelpers.kt", TestHelperGeneratorKt.createTextForCodegenTestHelpers(backend)));
|
||||
}
|
||||
return testFiles;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,8 @@ enum class TargetBackend(
|
||||
JVM_IR(true, JVM),
|
||||
JS(false),
|
||||
JS_IR(true, JS),
|
||||
WASM(true);
|
||||
WASM(true),
|
||||
ANDROID(false, JVM);
|
||||
|
||||
val compatibleWith get() = compatibleWithTargetBackend ?: ANY
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user