Remove WITH_UNSIGNED directive from tests

#KT-25226 Fixed
This commit is contained in:
Mikhail Zarechenskiy
2018-11-13 01:54:40 +03:00
parent cbaa8e5be2
commit d28488eaed
33 changed files with 28 additions and 101 deletions
@@ -1,4 +1,4 @@
// WITH_UNSIGNED
// WITH_RUNTIME
// IGNORE_BACKEND: JVM_IR
val xs = Array(2) { 42u }
@@ -1,5 +1,5 @@
// !LANGUAGE: +InlineClasses
// WITH_UNSIGNED
// WITH_RUNTIME
// IGNORE_BACKEND: JVM_IR
inline class Data(val data: Array<UInt>)
@@ -1,4 +1,4 @@
// WITH_UNSIGNED
// WITH_RUNTIME
// IGNORE_BACKEND: JVM_IR
const val maxUByte: UByte = 0xFFu
@@ -1,4 +1,4 @@
// WITH_UNSIGNED
// WITH_RUNTIME
// IGNORE_BACKEND: JVM_IR
fun isZeroUInt(n: UInt?) = n!! == 0U
@@ -1,4 +1,4 @@
// WITH_UNSIGNED
// WITH_RUNTIME
// IGNORE_BACKEND: JVM_IR
fun box(): String {
@@ -1,5 +1,5 @@
// IGNORE_BACKEND: JVM_IR
// WITH_UNSIGNED
// WITH_REFLECT
// TARGET_BACKEND: JVM
@file:Suppress("INVISIBLE_MEMBER")
@@ -1,5 +1,5 @@
// IGNORE_BACKEND: JVM_IR
// WITH_UNSIGNED
// WITH_RUNTIME
fun box(): String {
val a = listOf(1u, 2u, 3u)
@@ -1,4 +1,4 @@
// WITH_UNSIGNED
// WITH_RUNTIME
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND: JS_IR
@@ -1,4 +1,4 @@
// WITH_UNSIGNED
// WITH_RUNTIME
// IGNORE_BACKEND: JVM_IR
fun box(): String {
+1 -1
View File
@@ -1,4 +1,4 @@
// WITH_UNSIGNED
// WITH_RUNTIME
// IGNORE_BACKEND: JVM_IR
import kotlin.reflect.KProperty
@@ -1,4 +1,4 @@
// WITH_UNSIGNED
// WITH_RUNTIME
// IGNORE_BACKEND: JVM_IR
fun isZeroUInt(n: UInt?) = 0U == n
@@ -1,4 +1,4 @@
// WITH_UNSIGNED
// WITH_RUNTIME
// IGNORE_BACKEND: JVM_IR
fun isZeroUInt(n: UInt?) = n == 0U
@@ -1,4 +1,4 @@
// WITH_UNSIGNED
// WITH_RUNTIME
// IGNORE_BACKEND: JS_IR, JVM_IR
@file:Suppress("SIGNED_CONSTANT_CONVERTED_TO_UNSIGNED")
@@ -1,4 +1,4 @@
// WITH_UNSIGNED
// WITH_RUNTIME
// IGNORE_BACKEND: JVM_IR
fun box(): String {
@@ -1,4 +1,4 @@
// WITH_UNSIGNED
// WITH_RUNTIME
// IGNORE_BACKEND: JVM_IR
fun box(): String {
@@ -1,4 +1,4 @@
// WITH_UNSIGNED
// WITH_REFLECT
// IGNORE_BACKEND: JVM_IR
fun prefixDecrementUByteLocal(): Any? {
@@ -1,4 +1,4 @@
// WITH_UNSIGNED
// WITH_RUNTIME
// IGNORE_BACKEND: JVM_IR
const val MAX_BYTE: UByte = 0xFFu
@@ -1,5 +1,5 @@
// IGNORE_BACKEND: JVM_IR
// WITH_UNSIGNED
// WITH_RUNTIME
// IGNORE_BACKEND: JS_IR
fun uint(vararg us: UInt): UIntArray = us
@@ -1,4 +1,4 @@
// WITH_UNSIGNED
// WITH_RUNTIME
fun uint(vararg us: UInt): UIntArray = us
@@ -1,5 +1,5 @@
// IGNORE_BACKEND: NATIVE
// WITH_UNSIGNED
// WITH_RUNTIME
// FILE: A.kt
@@ -1,4 +1,4 @@
// WITH_UNSIGNED
// WITH_RUNTIME
// FILE: signedToUnsignedConversions_annotation.kt
@@ -1,4 +1,4 @@
// WITH_UNSIGNED
// WITH_RUNTIME
val testSimpleUIntLiteral = 1u
@@ -1,4 +1,4 @@
// WITH_UNSIGNED
// WITH_RUNTIME
package test
@@ -13,7 +13,7 @@ import org.jetbrains.kotlin.test.ConfigurationKind
abstract class AbstractDiagnosticsWithUnsignedTypes : AbstractDiagnosticsTest() {
override fun getConfigurationKind(): ConfigurationKind {
return ConfigurationKind.WITH_UNSIGNED_TYPES
return ConfigurationKind.NO_KOTLIN_REFLECT
}
override fun defaultLanguageVersionSettings(): LanguageVersionSettings =
@@ -198,12 +198,6 @@ public abstract class CodegenTestCase extends KtUsefulTestCase {
Map<String, String> directives = KotlinTestUtils.parseDirectives(testFile.content);
if (InTextDirectivesUtils.isDirectiveDefined(testFile.content, "WITH_UNSIGNED")) {
assertDirectivesToNull(explicitLanguageVersionSettings, explicitLanguageVersion);
explicitLanguageVersion = LanguageVersion.KOTLIN_1_3;
directives.put(API_VERSION_DIRECTIVE, ApiVersion.KOTLIN_1_3.getVersionString());
}
LanguageVersionSettings fileLanguageVersionSettings = parseLanguageVersionSettings(directives);
if (fileLanguageVersionSettings != null) {
assertDirectivesToNull(explicitLanguageVersionSettings, null);
@@ -422,18 +416,12 @@ public abstract class CodegenTestCase extends KtUsefulTestCase {
if (configurationKind.getWithReflection() && configurationKind.getWithCoroutines()) {
classLoader = ForTestCompileRuntime.reflectAndCoroutinesJarClassLoader();
}
else if (configurationKind.getWithUnsignedTypes() && configurationKind.getWithReflection()) {
classLoader = ForTestCompileRuntime.reflectAndUnsignedTypesJarClassLoader();
}
else if (configurationKind.getWithReflection()) {
classLoader = ForTestCompileRuntime.runtimeAndReflectJarClassLoader();
}
else if (configurationKind.getWithCoroutines()) {
classLoader = ForTestCompileRuntime.runtimeAndCoroutinesJarClassLoader();
}
else if (configurationKind.getWithUnsignedTypes()) {
classLoader = ForTestCompileRuntime.runtimeAndUnsignedTypesJarClassLoader();
}
else {
classLoader = ForTestCompileRuntime.runtimeJarClassLoader();
}
@@ -700,9 +688,6 @@ public abstract class CodegenTestCase extends KtUsefulTestCase {
if (configurationKind.getWithCoroutines()) {
javaClasspath.add(ForTestCompileRuntime.coroutinesJarForTests().getPath());
}
if (configurationKind.getWithUnsignedTypes()) {
javaClasspath.add(ForTestCompileRuntime.unsignedTypesJarForTests().getPath());
}
javaClassesOutputDirectory = CodegenTestUtil.compileJava(
findJavaSourcesInDirectory(javaSourceDir), javaClasspath, javacOptions
@@ -715,7 +700,6 @@ public abstract class CodegenTestCase extends KtUsefulTestCase {
boolean addRuntime = false;
boolean addReflect = false;
boolean addCoroutines = false;
boolean addUnsignedTypes = false;
for (TestFile file : files) {
if (InTextDirectivesUtils.isDirectiveDefined(file.content, "COMMON_COROUTINES_TEST") ||
InTextDirectivesUtils.isDirectiveDefined(file.content, "!LANGUAGE: +ReleaseCoroutines") ||
@@ -728,16 +712,11 @@ public abstract class CodegenTestCase extends KtUsefulTestCase {
if (InTextDirectivesUtils.isDirectiveDefined(file.content, "WITH_REFLECT")) {
addReflect = true;
}
if (InTextDirectivesUtils.isDirectiveDefined(file.content, "WITH_UNSIGNED")) {
addUnsignedTypes = true;
}
}
return (addReflect && addCoroutines && addUnsignedTypes) ? ConfigurationKind.ALL :
(addReflect && addCoroutines) ? ConfigurationKind.WITH_COROUTINES_AND_REFLECT :
return (addReflect && addCoroutines) ? ConfigurationKind.ALL :
addReflect ? ConfigurationKind.WITH_REFLECT :
addCoroutines ? ConfigurationKind.WITH_COROUTINES :
addUnsignedTypes ? ConfigurationKind.WITH_UNSIGNED_TYPES :
addRuntime ? ConfigurationKind.NO_KOTLIN_REFLECT :
ConfigurationKind.JDK_ONLY;
}
@@ -138,29 +138,6 @@ public class ForTestCompileRuntime {
return loader;
}
@NotNull
public static synchronized ClassLoader runtimeAndUnsignedTypesJarClassLoader() {
ClassLoader loader = unsignedTypesJarClassLoader.get();
if (loader == null) {
loader = createClassLoader(runtimeJarForTests(), unsignedTypesJarForTests(), scriptRuntimeJarForTests(), kotlinTestJarForTests());
unsignedTypesJarClassLoader = new SoftReference<>(loader);
}
return loader;
}
@NotNull
public static synchronized ClassLoader reflectAndUnsignedTypesJarClassLoader() {
ClassLoader loader = unsignedTypesAndReflectJarClassLoader.get();
if (loader == null) {
loader = createClassLoader(
runtimeJarForTests(), reflectJarForTests(), unsignedTypesJarForTests(),
scriptRuntimeJarForTests(), kotlinTestJarForTests()
);
unsignedTypesAndReflectJarClassLoader = new SoftReference<>(loader);
}
return loader;
}
@NotNull
public static synchronized ClassLoader reflectAndCoroutinesJarClassLoader() {
ClassLoader loader = coroutinesAndReflectJarClassLoader.get();
@@ -55,7 +55,6 @@ abstract class AbstractIrGeneratorTestCase : CodegenTestCase() {
val javacOptions = ArrayList<String>(0)
var addRuntime = false
var addReflect = false
var addUnsigned = false
for (file in files) {
if (InTextDirectivesUtils.isDirectiveDefined(file.content, "WITH_RUNTIME")) {
addRuntime = true
@@ -63,9 +62,6 @@ abstract class AbstractIrGeneratorTestCase : CodegenTestCase() {
if (InTextDirectivesUtils.isDirectiveDefined(file.content, "WITH_REFLECT")) {
addReflect = true
}
if (InTextDirectivesUtils.isDirectiveDefined(file.content, "WITH_UNSIGNED")) {
addUnsigned = true
}
javacOptions.addAll(InTextDirectivesUtils.findListWithPrefixes(file.content, "// JAVAC_OPTIONS:"))
}
@@ -73,7 +69,6 @@ abstract class AbstractIrGeneratorTestCase : CodegenTestCase() {
val configurationKind = when {
addReflect -> ConfigurationKind.ALL
addRuntime -> ConfigurationKind.NO_KOTLIN_REFLECT
addUnsigned -> ConfigurationKind.WITH_UNSIGNED_TYPES
else -> ConfigurationKind.JDK_ONLY
}
@@ -151,14 +151,7 @@ public abstract class AbstractLoadJavaTest extends TestCaseWithTmpdir {
Map<String, String> directives = KotlinTestUtils.parseDirectives(content);
LanguageVersionSettings languageVersionSettings = CompilerTestLanguageVersionSettingsKt.parseLanguageVersionSettings(directives);
if (languageVersionSettings == null) {
if (InTextDirectivesUtils.isDirectiveDefined(content, "WITH_UNSIGNED")) {
languageVersionSettings = new CompilerTestLanguageVersionSettings(
emptyMap(), ApiVersion.KOTLIN_1_3, LanguageVersion.KOTLIN_1_3, emptyMap()
);
}
else {
languageVersionSettings = CompilerTestLanguageVersionSettingsKt.defaultLanguageVersionSettings();
}
languageVersionSettings = CompilerTestLanguageVersionSettingsKt.defaultLanguageVersionSettings();
}
CommonConfigurationKeysKt.setLanguageVersionSettings(configuration, languageVersionSettings);
@@ -9,8 +9,7 @@ enum class ConfigurationKind(
val withRuntime: Boolean = false,
val withMockRuntime: Boolean = false,
val withReflection: Boolean = false,
val withCoroutines: Boolean = false,
val withUnsignedTypes: Boolean = false
val withCoroutines: Boolean = false
) {
/** JDK without any kotlin runtime */
JDK_NO_RUNTIME(),
@@ -20,12 +19,8 @@ enum class ConfigurationKind(
NO_KOTLIN_REFLECT(withRuntime = true),
/** JDK + kotlin runtime + coroutines */
WITH_COROUTINES(withCoroutines = true, withRuntime = true),
/** JDK + kotlin runtime + unsigned types */
WITH_UNSIGNED_TYPES(withUnsignedTypes = true, withRuntime = true, withReflection = true),
/** JDK + kotlin runtime + kotlin reflection */
WITH_REFLECT(withRuntime = true, withReflection = true),
/** JDK + kotlin runtime + kotlin reflection + coroutines */
WITH_COROUTINES_AND_REFLECT(withRuntime = true, withReflection = true, withCoroutines = true),
/** JDK + kotlin runtime + kotlin reflection + coroutines + unsigned types */
ALL(withRuntime = true, withReflection = true, withCoroutines = true, withUnsignedTypes = true)
ALL(withRuntime = true, withReflection = true, withCoroutines = true)
}
@@ -585,9 +585,6 @@ public class KotlinTestUtils {
if (configurationKind.getWithCoroutines()) {
JvmContentRootsKt.addJvmClasspathRoot(configuration, ForTestCompileRuntime.coroutinesJarForTests());
}
if (configurationKind.getWithUnsignedTypes()) {
JvmContentRootsKt.addJvmClasspathRoot(configuration, ForTestCompileRuntime.unsignedTypesJarForTests());
}
if (configurationKind.getWithRuntime()) {
JvmContentRootsKt.addJvmClasspathRoot(configuration, ForTestCompileRuntime.runtimeJarForTests());
JvmContentRootsKt.addJvmClasspathRoot(configuration, ForTestCompileRuntime.scriptRuntimeJarForTests());
@@ -580,9 +580,6 @@ public class KotlinTestUtils {
if (configurationKind.getWithCoroutines()) {
JvmContentRootsKt.addJvmClasspathRoot(configuration, ForTestCompileRuntime.coroutinesJarForTests());
}
if (configurationKind.getWithUnsignedTypes()) {
JvmContentRootsKt.addJvmClasspathRoot(configuration, ForTestCompileRuntime.unsignedTypesJarForTests());
}
if (configurationKind.getWithRuntime()) {
JvmContentRootsKt.addJvmClasspathRoot(configuration, ForTestCompileRuntime.runtimeJarForTests());
JvmContentRootsKt.addJvmClasspathRoot(configuration, ForTestCompileRuntime.scriptRuntimeJarForTests());
@@ -580,9 +580,6 @@ public class KotlinTestUtils {
if (configurationKind.getWithCoroutines()) {
JvmContentRootsKt.addJvmClasspathRoot(configuration, ForTestCompileRuntime.coroutinesJarForTests());
}
if (configurationKind.getWithUnsignedTypes()) {
JvmContentRootsKt.addJvmClasspathRoot(configuration, ForTestCompileRuntime.unsignedTypesJarForTests());
}
if (configurationKind.getWithRuntime()) {
JvmContentRootsKt.addJvmClasspathRoot(configuration, ForTestCompileRuntime.runtimeJarForTests());
JvmContentRootsKt.addJvmClasspathRoot(configuration, ForTestCompileRuntime.scriptRuntimeJarForTests());
@@ -580,9 +580,6 @@ public class KotlinTestUtils {
if (configurationKind.getWithCoroutines()) {
JvmContentRootsKt.addJvmClasspathRoot(configuration, ForTestCompileRuntime.coroutinesJarForTests());
}
if (configurationKind.getWithUnsignedTypes()) {
JvmContentRootsKt.addJvmClasspathRoot(configuration, ForTestCompileRuntime.unsignedTypesJarForTests());
}
if (configurationKind.getWithRuntime()) {
JvmContentRootsKt.addJvmClasspathRoot(configuration, ForTestCompileRuntime.runtimeJarForTests());
JvmContentRootsKt.addJvmClasspathRoot(configuration, ForTestCompileRuntime.scriptRuntimeJarForTests());