[Spec tests] Updating tests for kotlin 1.4.0
This commit is contained in:
committed by
Victor Petukhov
parent
ab3b63c92a
commit
1caafdc9d4
@@ -55,7 +55,7 @@ fun checkCallableTypeParametersWithUpperBounds(callableRef: KCallable<*>, typePa
|
||||
fun checkSuperTypeAnnotation(classRef: KClass<*>, superClassName: String, annotationName: String): Boolean {
|
||||
val superType = classRef.supertypes.find { it.classifier.toString() == superClassName }
|
||||
|
||||
return superType?.annotations?.find { it.annotationClass.qualifiedName == annotationName } != null ?: false
|
||||
return superType?.annotations?.find { it.annotationClass.qualifiedName == annotationName } != null
|
||||
}
|
||||
|
||||
fun checkClassName(ref: KClass<*>, expectedQualifiedName: String) = ref.qualifiedName == expectedQualifiedName
|
||||
@@ -64,7 +64,7 @@ fun checkPackageName(fileClass: String, expectedName: String) =
|
||||
Class.forName(fileClass).`package`.name == expectedName
|
||||
|
||||
fun checkFileAnnotation(fileClass: String, expectedName: String) =
|
||||
Class.forName(fileClass)?.annotations?.find { it.annotationClass.qualifiedName == expectedName } != null ?: false
|
||||
Class.forName(fileClass)?.annotations?.find { it.annotationClass.qualifiedName == expectedName } != null
|
||||
|
||||
fun checkFileAnnotations(fileClass: String, expectedNames: List<String>) =
|
||||
expectedNames.all { checkFileAnnotation(fileClass, it) }
|
||||
|
||||
Vendored
+3
-11
@@ -1,4 +1,3 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// FULL_JDK
|
||||
// WITH_RUNTIME
|
||||
|
||||
@@ -13,24 +12,17 @@
|
||||
|
||||
// FILE: JavaClass.java
|
||||
public class JavaClass{
|
||||
public static <T> T id(T x) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Boolean x;
|
||||
}
|
||||
|
||||
// FILE: KotlinClass.kt
|
||||
import java.lang.IllegalStateException
|
||||
|
||||
fun box(): String {
|
||||
val x = JavaClass.id(null) // Nothing!
|
||||
|
||||
return try {
|
||||
val a = if (x) {
|
||||
"NOK"
|
||||
} else "NOK"
|
||||
val a = if (JavaClass().x) { "NOK" } else "NOK"
|
||||
a
|
||||
} catch (e: java.lang.IllegalStateException) {
|
||||
} catch (e: java.lang.NullPointerException) {
|
||||
"OK"
|
||||
}
|
||||
}
|
||||
Vendored
-28
@@ -1,28 +0,0 @@
|
||||
// FULL_JDK
|
||||
// WITH_RUNTIME
|
||||
|
||||
/*
|
||||
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-220
|
||||
* PLACE: expressions, conditional-expression -> paragraph 6 -> sentence 1
|
||||
* NUMBER: 2
|
||||
* DESCRIPTION: The type of the condition expression must be a subtype of kotlin.Boolean, otherwise it is an error
|
||||
*/
|
||||
|
||||
// FILE: JavaClass.java
|
||||
public class JavaClass{
|
||||
public Boolean x;
|
||||
}
|
||||
|
||||
// FILE: KotlinClass.kt
|
||||
import java.lang.IllegalStateException
|
||||
|
||||
fun box(): String {
|
||||
return try {
|
||||
val a = if (JavaClass().x) { "NOK" } else "NOK"
|
||||
a
|
||||
} catch (e: java.lang.IllegalStateException) {
|
||||
"OK"
|
||||
}
|
||||
}
|
||||
Vendored
-6
@@ -2,12 +2,6 @@
|
||||
"6": {
|
||||
"pos": {
|
||||
"1": [
|
||||
{
|
||||
"specVersion": "0.1-220",
|
||||
"casesNumber": 0,
|
||||
"description": "The type of the condition expression must be a subtype of kotlin.Boolean, otherwise it is an error",
|
||||
"unexpectedBehaviour": false
|
||||
},
|
||||
{
|
||||
"specVersion": "0.1-220",
|
||||
"casesNumber": 0,
|
||||
|
||||
+2
-1
@@ -6,7 +6,8 @@
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the class.
|
||||
* NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY!
|
||||
* HELPERS: REFLECT
|
||||
* HELPERS: reflect
|
||||
* UNEXPECTED BEHAVIOUR
|
||||
*/
|
||||
|
||||
open class `true` {
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
* NUMBER: 10
|
||||
* DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the companionObject.
|
||||
* NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY!
|
||||
* HELPERS: REFLECT
|
||||
* HELPERS: reflect
|
||||
*/
|
||||
|
||||
package org.jetbrains.`true`
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
* NUMBER: 11
|
||||
* DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the function.
|
||||
* NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY!
|
||||
* HELPERS: REFLECT
|
||||
* HELPERS: reflect
|
||||
*/
|
||||
|
||||
fun `true`(): Boolean {
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
* NUMBER: 12
|
||||
* DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the setter.
|
||||
* NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY!
|
||||
* HELPERS: REFLECT
|
||||
* HELPERS: reflect
|
||||
*/
|
||||
|
||||
class A {
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
* NUMBER: 13
|
||||
* DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the simpleUserType.
|
||||
* NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY!
|
||||
* HELPERS: REFLECT
|
||||
* HELPERS: reflect
|
||||
*/
|
||||
|
||||
package org.jetbrains.`true`
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
* NUMBER: 14
|
||||
* DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the typeParameter.
|
||||
* NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY!
|
||||
* HELPERS: REFLECT
|
||||
* HELPERS: reflect
|
||||
*/
|
||||
|
||||
package org.jetbrains.`true`
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
* NUMBER: 15
|
||||
* DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the parameter.
|
||||
* NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY!
|
||||
* HELPERS: REFLECT
|
||||
* HELPERS: reflect
|
||||
*/
|
||||
|
||||
fun f1(`true`: Boolean) = !!!`true`
|
||||
|
||||
+2
-1
@@ -6,7 +6,8 @@
|
||||
* NUMBER: 16
|
||||
* DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the fileAnnotationComplex.
|
||||
* NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY!
|
||||
* HELPERS: REFLECT
|
||||
* HELPERS: reflect
|
||||
* UNEXPECTED BEHAVIOUR
|
||||
*/
|
||||
|
||||
@file:[org.jetbrains.`true`.`false`() `true`]
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
* NUMBER: 17
|
||||
* DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the object.
|
||||
* NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY!
|
||||
* HELPERS: REFLECT
|
||||
* HELPERS: reflect
|
||||
*/
|
||||
|
||||
open class A {
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
* NUMBER: 18
|
||||
* DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the typeAlias.
|
||||
* NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY!
|
||||
* HELPERS: REFLECT
|
||||
* HELPERS: reflect
|
||||
*/
|
||||
|
||||
typealias `true` = Boolean
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
* NUMBER: 26
|
||||
* DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the callableReference.
|
||||
* NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY!
|
||||
* HELPERS: REFLECT
|
||||
* HELPERS: reflect
|
||||
*/
|
||||
|
||||
val Boolean.`true`: Boolean
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
* NUMBER: 3
|
||||
* DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the typeConstraint.
|
||||
* NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY!
|
||||
* HELPERS: REFLECT
|
||||
* HELPERS: reflect
|
||||
*/
|
||||
|
||||
class A <`true`, `false`>
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
* NUMBER: 4
|
||||
* DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the fileAnnotationSimple.
|
||||
* NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY!
|
||||
* HELPERS: REFLECT
|
||||
* HELPERS: reflect
|
||||
*/
|
||||
|
||||
@file:`true`
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
* NUMBER: 5
|
||||
* DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the packageComplex.
|
||||
* NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY!
|
||||
* HELPERS: REFLECT
|
||||
* HELPERS: reflect
|
||||
*/
|
||||
|
||||
package org.jetbrains.`true`
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
* NUMBER: 6
|
||||
* DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the packageSimple.
|
||||
* NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY!
|
||||
* HELPERS: REFLECT
|
||||
* HELPERS: reflect
|
||||
*/
|
||||
|
||||
package `true`
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
* NUMBER: 9
|
||||
* DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the unescapedAnnotation.
|
||||
* NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY!
|
||||
* HELPERS: REFLECT
|
||||
* HELPERS: reflect
|
||||
*/
|
||||
|
||||
package org.jetbrains.`true`
|
||||
|
||||
+2
-2
@@ -18,7 +18,7 @@
|
||||
"specVersion": "0.1-100",
|
||||
"casesNumber": 0,
|
||||
"description": "The use of Boolean literals as the identifier (with backtick) in the class.",
|
||||
"unexpectedBehaviour": false
|
||||
"unexpectedBehaviour": true
|
||||
},
|
||||
{
|
||||
"specVersion": "0.1-100",
|
||||
@@ -102,7 +102,7 @@
|
||||
"specVersion": "0.1-100",
|
||||
"casesNumber": 0,
|
||||
"description": "The use of Boolean literals as the identifier (with backtick) in the fileAnnotationComplex.",
|
||||
"unexpectedBehaviour": false
|
||||
"unexpectedBehaviour": true
|
||||
},
|
||||
{
|
||||
"specVersion": "0.1-100",
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
java.lang.IllegalStateException: TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH: Type inference failed. Expected type mismatch: inferred type is Test<Nothing?> but Base<T> was expected (7,38) in /KotlinClass.kt
|
||||
java.lang.IllegalStateException: TYPE_MISMATCH: Type mismatch: inferred type is Test<Nothing?> but Base<T> was expected (7,38) in /KotlinClass.kt
|
||||
|
||||
@@ -24,7 +24,7 @@ public class Test<T> extends Base<T> {
|
||||
|
||||
open class Base<out T>(val prop: T)
|
||||
|
||||
class Inheritor <T : Any> {
|
||||
class Inheritor<T : Any> {
|
||||
companion object {
|
||||
fun <T> default(): Base<T> = Test(null)
|
||||
}
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// FULL_JDK
|
||||
// WITH_RUNTIME
|
||||
|
||||
/*
|
||||
* KOTLIN CODEGEN BOX NOT LINKED SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SECTIONS: flexibility
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: check Nothing flexibillity
|
||||
* ISSUES: KT-35700
|
||||
*/
|
||||
|
||||
// FILE: JavaClass.java
|
||||
public class JavaClass{
|
||||
public static <T> T id(T x) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: KotlinClass.kt
|
||||
|
||||
fun box(): String {
|
||||
val x = JavaClass.id(null) // Nothing!
|
||||
|
||||
return try {
|
||||
val a = if (x) {
|
||||
"NOK"
|
||||
} else "NOK"
|
||||
a
|
||||
} catch (e: IllegalStateException) {
|
||||
"OK"
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// FULL_JDK
|
||||
// WITH_RUNTIME
|
||||
|
||||
/*
|
||||
* KOTLIN CODEGEN BOX NOT LINKED SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SECTIONS: flexibility
|
||||
* NUMBER: 2
|
||||
* DESCRIPTION: check Nothing flexibillity
|
||||
* ISSUES: KT-35700
|
||||
*/
|
||||
|
||||
// FILE: Test.java
|
||||
|
||||
public class Test<T> extends Base<T> {
|
||||
public Test (T arg) {
|
||||
super(arg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// FILE: KotlinClass.kt
|
||||
|
||||
open class Base<out T>(val prop: T)
|
||||
|
||||
class Inheritor <T : Any> {
|
||||
companion object {
|
||||
fun <T> default(): Base<T> = Test(null)
|
||||
}
|
||||
}
|
||||
|
||||
fun box() : String{
|
||||
val v: Base<String> = Inheritor.default()
|
||||
try {
|
||||
println(v.prop.length)
|
||||
}catch (e: Exception ){
|
||||
return "OK"
|
||||
}
|
||||
return "NOK"
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user