[Spec tests] Add fixed tests for expressions section, fix linkage for reference-equality-expressions section

This commit is contained in:
anastasiia.spaseeva
2019-12-26 15:11:29 +03:00
parent 9e3ecbd902
commit e0743f2268
42 changed files with 1162 additions and 106 deletions
@@ -1 +0,0 @@
java.lang.IllegalStateException: OPERATOR_MODIFIER_REQUIRED: 'operator' modifier is required on 'compareTo' in 'A' (24,17) in /2.1.kt
@@ -1,26 +0,0 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-218
* PLACE: expressions, comparison-expressions -> paragraph 1 -> sentence 2
* NUMBER: 1
* DESCRIPTION: expressions, comparison-expressions -> paragraph 1 -> sentence 2
* EXCEPTION: compiletime
*/
class A(val a: Int) {
var isCompared = false
fun compareTo(other: A): Int = run {
isCompared = true
this.a - other.a
}
}
fun box() {
val a3 = A(-1)
val a4 = A(-3)
val x = (a3 > a4)
}
@@ -1,15 +1,5 @@
{
"1": {
"neg": {
"2": [
{
"specVersion": "0.1-218",
"casesNumber": 0,
"description": "expressions, comparison-expressions -\u003e paragraph 1 -\u003e sentence 2",
"unexpectedBehaviour": false
}
]
},
"pos": {
"2": [
{
@@ -0,0 +1,20 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-218
* PLACE: expressions, conditional-expression -> paragraph 1 -> sentence 2
* NUMBER: 5
* DESCRIPTION: if-expression: check the correct branch is evaluating
*/
fun box() : String{
if (get(null)?: if (get(false)!!) false else get(true)!!)
return "OK"
return "NOK"
}
fun get(b: Boolean?): Boolean? = b
@@ -0,0 +1,19 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-218
* PLACE: expressions, conditional-expression -> paragraph 1 -> sentence 2
* NUMBER: 6
* DESCRIPTION: if-expression: check the correct branch is evaluating
*/
fun box() : String{
if (get(null)?: if (get(true)!!) false else get(true)!!)
return "NOK"
return "OK"
}
fun get(b: Boolean?): Boolean? = b
@@ -0,0 +1,25 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-218
* PLACE: expressions, conditional-expression -> paragraph 1 -> sentence 2
* NUMBER: 7
* DESCRIPTION: if-expression: check the correct branch is evaluating
*/
fun box(): String {
val x = if (get(null) ?: if (try {
TODO()
} catch (e: NotImplementedError) {
get(false)!!
}
) false else get(true)!!
) get(true) else false
if (x!!) return "OK"
return "NOK"
}
fun get(b: Boolean?): Boolean? = b
@@ -0,0 +1,31 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-218
* PLACE: expressions, conditional-expression -> paragraph 1 -> sentence 2
* NUMBER: 8
* DESCRIPTION: if-expression: check the correct branch is evaluating
*/
fun box(): String {
var x = 10
var flag1 = false
if (x == 10.also { x = 11 }) {
flag1 = true
}
var flag2 = false
if (x == if (true) {x = 12; 11} else 11) {
flag2 = true
}
var flag3 = false
if (12.also { x = 13 } == x) {
flag3 = true
}
if (flag1 && flag2 && !flag3)
return "OK"
return "NOK"
}
@@ -6,10 +6,32 @@
* SPEC VERSION: 0.1-218
* PLACE: expressions, conditional-expression -> paragraph 2 -> sentence 1
* NUMBER: 1
* DESCRIPTION:
* DESCRIPTION: branchless conditional expression, despite being of almost no practical use, is valid in Kotlin
*/
fun box(): String {
if (true) else;
if (true) else; ;
if (true) else ;
if (true)
else;
if (true) else
;
val x = {
if (true) else;
}
if (false) else;
if (false) else; ;
if (false) else ;
if (false)
else;
if (false) else
;
val x1 = {
if (false) else;
}
return "OK"
}
@@ -0,0 +1,36 @@
// !LANGUAGE: +NewInference
// FULL_JDK
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-220
* PLACE: expressions, conditional-expression -> paragraph 6 -> sentence 1
* NUMBER: 1
* 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 static <T> T id(T x) {
return null;
}
}
// 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"
a
} catch (e: java.lang.IllegalStateException) {
"OK"
}
}
@@ -0,0 +1,28 @@
// 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"
}
}
@@ -1,7 +1,49 @@
{
"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,
"description": "The type of the condition expression must be a subtype of kotlin.Boolean, otherwise it is an error",
"unexpectedBehaviour": false
}
]
}
},
"1": {
"pos": {
"2": [
{
"specVersion": "0.1-218",
"casesNumber": 0,
"description": "if-expression: check the correct branch is evaluating",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-218",
"casesNumber": 0,
"description": "if-expression: check the correct branch is evaluating",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-218",
"casesNumber": 0,
"description": "if-expression: check the correct branch is evaluating",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-218",
"casesNumber": 0,
"description": "if-expression: check the correct branch is evaluating",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-218",
"casesNumber": 0,
@@ -48,7 +90,7 @@
{
"specVersion": "0.1-218",
"casesNumber": 0,
"description": "",
"description": "branchless conditional expression, despite being of almost no practical use, is valid in Kotlin",
"unexpectedBehaviour": false
}
]
@@ -13,20 +13,27 @@
fun box(): String {
val x : Boolean? = null ?: getNull() ?: A().b ?: getTrue() ?: false
val x: Boolean? = null ?: getNull(null) ?: A().b ?: getTrue() ?: false
val s = null == getNull(null) ?: !getNullableTrue()!! || getFalse() ?: false
val k = ((getNull(null)?: getNull(null) ) ?: getNull(true)) ?: getFalse()
try {
val y = null ?: throw ExcA()
val y = null ?: throw ExcA()
} catch (e: ExcA) {
if (x == true) return "OK"
if ((x == true && !s && k!!)) return "OK"
}
return "NOK"
}
fun getTrue() = true
fun getNull(): Boolean? = null
fun getNull(b: Boolean?): Boolean? = b
class A(val b: Boolean? = null)
class ExcA() : Exception()
class ExcA() : Exception()
fun getFalse(): Boolean? { return false }
fun getNullableTrue(): Boolean? { return true }
@@ -5,7 +5,6 @@
*
* SPEC VERSION: 0.1-213
* PLACE: expressions, equality-expressions, reference-equality-expressions -> paragraph 1 -> sentence 2
* RELEVANT PLACES: expressions, built-in-types-and-their-semantics, kotlin.unit -> paragraph 1 -> sentence 1
* NUMBER: 1
* DESCRIPTION: check if two values are equal (===) by reference
*/
@@ -5,8 +5,7 @@
*
* SPEC VERSION: 0.1-213
* PLACE: expressions, equality-expressions, reference-equality-expressions -> paragraph 1 -> sentence 2
* RELEVANT PLACES: expressions, built-in-types-and-their-semantics, kotlin.unit -> paragraph 1 -> sentence 1,
* expressions, equality-expressions, reference-equality-expressions -> paragraph 3 -> sentence 3
* RELEVANT PLACES: expressions, equality-expressions, reference-equality-expressions -> paragraph 3 -> sentence 3
* expressions, equality-expressions, reference-equality-expressions -> paragraph 2 -> sentence 1
* NUMBER: 2
* DESCRIPTION: check if two values are equal (===) by reference
@@ -5,7 +5,6 @@
*
* SPEC VERSION: 0.1-213
* PLACE: expressions, equality-expressions, reference-equality-expressions -> paragraph 1 -> sentence 2
* RELEVANT PLACES: expressions, built-in-types-and-their-semantics, kotlin.unit -> paragraph 1 -> sentence 1
* NUMBER: 3
* DESCRIPTION: check if two values are non-equal (!==) by reference
*/
@@ -5,7 +5,6 @@
*
* SPEC VERSION: 0.1-213
* PLACE: expressions, equality-expressions, reference-equality-expressions -> paragraph 1 -> sentence 2
* RELEVANT PLACES: expressions, built-in-types-and-their-semantics, kotlin.unit -> paragraph 1 -> sentence 1
* NUMBER: 4
* DESCRIPTION: check if values are non-equal (!==) by reference
*/
@@ -5,7 +5,6 @@
*
* SPEC VERSION: 0.1-213
* PLACE: expressions, equality-expressions, reference-equality-expressions -> paragraph 1 -> sentence 2
* RELEVANT PLACES: expressions, built-in-types-and-their-semantics, kotlin.unit -> paragraph 1 -> sentence 1
* NUMBER: 5
* DESCRIPTION: two values are equal (===) or non-equal (!==) by reference
*/
@@ -5,7 +5,6 @@
*
* SPEC VERSION: 0.1-213
* PLACE: expressions, equality-expressions, reference-equality-expressions -> paragraph 1 -> sentence 3
* RELEVANT PLACES: expressions, built-in-types-and-their-semantics, kotlin.unit -> paragraph 1 -> sentence 1
* NUMBER: 1
* DESCRIPTION: check equallity by refference via constructor
*/
@@ -10,8 +10,13 @@
*/
// FILE: JavaClass.java
public class JavaClass{
public static Object NULL_VALUE ;
public class JavaClass {
public static Object NULL_VALUE;
public Integer x;
public static <T> T id(T x) { return null; }
}
// FILE: KotlinClass.kt
@@ -27,10 +32,31 @@ fun box(): String {
val x = null
if (null === x) {
if (x === null)
flag2 = true
flag2 = true
}
if (flag1 && flag2) return "OK"
var flag3 = false
if (null === null)
flag3 = true
var flag4 = false
val s: String? = null
if (s === JavaClass.NULL_VALUE)
if (JavaClass.NULL_VALUE === s)
flag4 = true
var flag5 = false
if (null === JavaClass().x)
if (JavaClass().x === null)
flag5 = true
var flag6 = false
if (null === JavaClass.id(null))
if (JavaClass.id(null) === null)
flag6 = true
if (flag1 && flag2 && flag3 && flag4 && flag5 &&flag6) return "OK"
else
return "NOK"
}
@@ -0,0 +1,47 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-218
* PLACE: expressions, equality-expressions, reference-equality-expressions -> paragraph 3 -> sentence 2
* NUMBER: 2
* DESCRIPTION: Any instance of the null reference null is equal by reference to any other instance of the null reference;
*/
// FILE: JavaClass.java
public class JavaClass {
public static Object NULL_VALUE;
public Integer x;
public static <T> T id(T x) { return null; }
}
// FILE: KotlinClass.kt
fun box(): String {
if (null !== JavaClass.NULL_VALUE) return "NOK"
if (JavaClass.NULL_VALUE !== null) return "NOK"
val x = null
if (null !== x) return "NOK"
if (x !== null) return "NOK"
if (null !== null) return "NOK"
val s: String? = null
if (s !== JavaClass.NULL_VALUE) return "NOK"
if (JavaClass.NULL_VALUE !== s) return "NOK"
if (getNull(true) !== getNull(false) === getNull(true) !== getNull(false) === getNull(true)) return "NOK"
if (JavaClass().x !== null) return "NOK"
if (null !== JavaClass().x ) return "NOK"
if (JavaClass.id(null) !== null) return "NOK"
if (null !== JavaClass.id(null) ) return "NOK"
return "OK"
}
fun getNull(x: Boolean): Any? = if (x) null else ""
@@ -52,7 +52,22 @@
},
"3": {
"pos": {
"3": [
{
"specVersion": "0.1-213",
"casesNumber": 0,
"description": "check if two values are equal (\u003d\u003d\u003d) by reference",
"path": "compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/reference-equality-expressions/p-1/pos/2.2.kt",
"unexpectedBehaviour": false
}
],
"2": [
{
"specVersion": "0.1-218",
"casesNumber": 0,
"description": "Any instance of the null reference null is equal by reference to any other instance of the null reference;",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-218",
"casesNumber": 0,
@@ -16,18 +16,21 @@ fun box(): String {
val x = A(false)
val y = A(false)
if (x == y) {
if ((x == y) == checkEqualls(x, y)) {
if (x.isEqualsCalled && !y.isEqualsCalled)
return "OK"
}
return "NOK"
}
fun checkEqualls(A: Any?, B: Any?): Boolean {
return (A as? Any)?.equals(B) ?: (B === null)
}
data class A(val a: Boolean) {
var isEqualsCalled = false
override fun equals(anObject: Any?): Boolean {
override operator fun equals(anObject: Any?): Boolean {
isEqualsCalled = true
if (this === anObject) {
return true
@@ -0,0 +1,44 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-218
* PLACE: expressions, equality-expressions, value-equality-expressions -> paragraph 2 -> sentence 1
* RELEVANT PLACES: expressions, equality-expressions, value-equality-expressions -> paragraph 3 -> sentence 1
* NUMBER: 2
* DESCRIPTION: check value-equality-expression
*/
//A == B is exactly the same as (A as? Any)?.equals(B) ?: (B === null) where equals is the method of kotlin.Any;
fun box(): String {
val x = A(false)
val y = A(true)
if ((x == y) == checkEqualls(x, y)) {
if (x.isEqualsCalled)
return "OK"
}
return "NOK"
}
fun checkEqualls(A: Any?, B: Any?): Boolean {
return (A as? Any)?.equals(B) ?: (B === null)
}
data class A(val a: Boolean) {
var isEqualsCalled = false
override operator fun equals(anObject: Any?): Boolean {
isEqualsCalled = true
if (this === anObject) {
return true
}
if (anObject is A) {
if (anObject.a == a)
return true
}
return false
}
}
@@ -0,0 +1,44 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-218
* PLACE: expressions, equality-expressions, value-equality-expressions -> paragraph 2 -> sentence 1
* RELEVANT PLACES: expressions, equality-expressions, value-equality-expressions -> paragraph 3 -> sentence 1
* NUMBER: 3
* DESCRIPTION: check value-equality-expression
*/
//A == B is exactly the same as (A as? Any)?.equals(B) ?: (B === null) where equals is the method of kotlin.Any;
fun box(): String {
val x = A(false)
val y = null
if ((x == y) == checkEqualls(x, y)) {
if (x.isEqualsCalled)
return "OK"
}
return "NOK"
}
fun checkEqualls(A: Any?, B: Any?): Boolean {
return (A as? Any)?.equals(B) ?: (B === null)
}
data class A(val a: Boolean) {
var isEqualsCalled = false
override operator fun equals(anObject: Any?): Boolean {
isEqualsCalled = true
if (this === anObject) {
return true
}
if (anObject is A) {
if (anObject.a == a)
return true
}
return false
}
}
@@ -0,0 +1,43 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-218
* PLACE: expressions, equality-expressions, value-equality-expressions -> paragraph 2 -> sentence 1
* RELEVANT PLACES: expressions, equality-expressions, value-equality-expressions -> paragraph 3 -> sentence 1
* NUMBER: 4
* DESCRIPTION: check value-equality-expression
*/
//A == B is exactly the same as (A as? Any)?.equals(B) ?: (B === null) where equals is the method of kotlin.Any;
fun box(): String {
val x = null
val y = null
if ((x == y) == checkEqualls(x, y)) {
return "OK"
}
return "NOK"
}
fun checkEqualls(A: Any?, B: Any?): Boolean {
return (A as? Any)?.equals(B) ?: (B === null)
}
data class A(val a: Boolean) {
var isEqualsCalled = false
override operator fun equals(anObject: Any?): Boolean {
isEqualsCalled = true
if (this === anObject) {
return true
}
if (anObject is A) {
if (anObject.a == a)
return true
}
return false
}
}
@@ -0,0 +1,44 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-218
* PLACE: expressions, equality-expressions, value-equality-expressions -> paragraph 2 -> sentence 1
* RELEVANT PLACES: expressions, equality-expressions, value-equality-expressions -> paragraph 3 -> sentence 1
* NUMBER: 5
* DESCRIPTION: check value-equality-expression
*/
//A == B is exactly the same as (A as? Any)?.equals(B) ?: (B === null) where equals is the method of kotlin.Any;
fun box(): String {
val x: A = A(false)
val y: Any = ""
if ((x == y) == checkEqualls(x, y)) {
if (x.isEqualsCalled)
return "OK"
}
return "NOK"
}
fun checkEqualls(A: Any?, B: Any?): Boolean {
return (A as? Any)?.equals(B) ?: (B === null)
}
data class A(val a: Boolean) {
var isEqualsCalled = false
override operator fun equals(anObject: Any?): Boolean {
isEqualsCalled = true
if (this === anObject) {
return true
}
if (anObject is A) {
if (anObject.a == a)
return true
}
return false
}
}
@@ -1,10 +1,10 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (NEGATIVE)
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-218
* PLACE: expressions, equality-expressions, value-equality-expressions -> paragraph 2 -> sentence 1
* PLACE: expressions, equality-expressions, value-equality-expressions -> paragraph 2 -> sentence 2
* NUMBER: 1
* DESCRIPTION: check value-equality-expression
*/
@@ -12,22 +12,27 @@
//A != B is exactly the same as !((A as? Any)?.equals(B) ?: (B === null)) where equals is the method of kotlin.Any.
fun box():String{
val x = A(true)
val y = A(false)
if (x != y) {
if ((x != y) == checkNotEquals(x, y)) {
if (x.isEqualsCalled && !y.isEqualsCalled)
return "OK"
}
return "NOK"
}
fun checkNotEquals(A: Any?, B: Any?): Boolean {
return !((A as? Any)?.equals(B) ?: (B === null))
}
data class A(val a: Boolean) {
var isEqualsCalled = false
override fun equals(anObject: Any?): Boolean {
override operator fun equals(anObject: Any?): Boolean {
isEqualsCalled = true
if (this === anObject) {
return true
@@ -0,0 +1,45 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-218
* PLACE: expressions, equality-expressions, value-equality-expressions -> paragraph 2 -> sentence 2
* NUMBER: 2
* DESCRIPTION: check value-equality-expression
*/
//A != B is exactly the same as !((A as? Any)?.equals(B) ?: (B === null)) where equals is the method of kotlin.Any.
fun box():String{
val x = A(true)
val y = A(true)
if ((x != y) == checkNotEquals(x, y)) {
if (x.isEqualsCalled && !y.isEqualsCalled)
return "OK"
}
return "NOK"
}
fun checkNotEquals(A: Any?, B: Any?): Boolean {
return !((A as? Any)?.equals(B) ?: (B === null))
}
data class A(val a: Boolean) {
var isEqualsCalled = false
override operator fun equals(anObject: Any?): Boolean {
isEqualsCalled = true
if (this === anObject) {
return true
}
if (anObject is A) {
if (anObject.a == a)
return true
}
return false
}
}
@@ -0,0 +1,44 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-218
* PLACE: expressions, equality-expressions, value-equality-expressions -> paragraph 2 -> sentence 2
* NUMBER: 3
* DESCRIPTION: check value-equality-expression
*/
//A != B is exactly the same as !((A as? Any)?.equals(B) ?: (B === null)) where equals is the method of kotlin.Any.
fun box():String{
val x = null
val y = A(true)
if ((x != y) == checkNotEquals(x, y)) {
return "OK"
}
return "NOK"
}
fun checkNotEquals(A: Any?, B: Any?): Boolean {
return !((A as? Any)?.equals(B) ?: (B === null))
}
data class A(val a: Boolean) {
var isEqualsCalled = false
override operator fun equals(anObject: Any?): Boolean {
isEqualsCalled = true
if (this === anObject) {
return true
}
if (anObject is A) {
if (anObject.a == a)
return true
}
return false
}
}
@@ -0,0 +1,44 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-218
* PLACE: expressions, equality-expressions, value-equality-expressions -> paragraph 2 -> sentence 2
* NUMBER: 4
* DESCRIPTION: check value-equality-expression
*/
//A != B is exactly the same as !((A as? Any)?.equals(B) ?: (B === null)) where equals is the method of kotlin.Any.
fun box():String{
val x = null
val y = null
if ((x != y) == checkNotEquals(x, y)) {
return "OK"
}
return "NOK"
}
fun checkNotEquals(A: Any?, B: Any?): Boolean {
return !((A as? Any)?.equals(B) ?: (B === null))
}
data class A(val a: Boolean) {
var isEqualsCalled = false
override operator fun equals(anObject: Any?): Boolean {
isEqualsCalled = true
if (this === anObject) {
return true
}
if (anObject is A) {
if (anObject.a == a)
return true
}
return false
}
}
@@ -0,0 +1,45 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-218
* PLACE: expressions, equality-expressions, value-equality-expressions -> paragraph 2 -> sentence 2
* NUMBER: 5
* DESCRIPTION: check value-equality-expression
*/
//A != B is exactly the same as !((A as? Any)?.equals(B) ?: (B === null)) where equals is the method of kotlin.Any.
fun box():String{
val x = A(true)
val y : Any = ""
if ((x != y) == checkNotEquals(x, y)) {
if (x.isEqualsCalled)
return "OK"
}
return "NOK"
}
fun checkNotEquals(A: Any?, B: Any?): Boolean {
return !((A as? Any)?.equals(B) ?: (B === null))
}
data class A(val a: Boolean) {
var isEqualsCalled = false
override operator fun equals(anObject: Any?): Boolean {
isEqualsCalled = true
if (this === anObject) {
return true
}
if (anObject is A) {
if (anObject.a == a)
return true
}
return false
}
}
@@ -1,17 +1,63 @@
{
"2": {
"neg": {
"1": [
"pos": {
"2": [
{
"specVersion": "0.1-218",
"casesNumber": 0,
"description": "check value-equality-expression",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-218",
"casesNumber": 0,
"description": "check value-equality-expression",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-218",
"casesNumber": 0,
"description": "check value-equality-expression",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-218",
"casesNumber": 0,
"description": "check value-equality-expression",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-218",
"casesNumber": 0,
"description": "check value-equality-expression",
"unexpectedBehaviour": false
}
]
},
"pos": {
],
"1": [
{
"specVersion": "0.1-218",
"casesNumber": 0,
"description": "check value-equality-expression",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-218",
"casesNumber": 0,
"description": "check value-equality-expression",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-218",
"casesNumber": 0,
"description": "check value-equality-expression",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-218",
"casesNumber": 0,
"description": "check value-equality-expression",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-218",
"casesNumber": 0,
@@ -24,6 +70,34 @@
"3": {
"pos": {
"1": [
{
"specVersion": "0.1-218",
"casesNumber": 0,
"description": "check value-equality-expression",
"path": "compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/1.2.kt",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-218",
"casesNumber": 0,
"description": "check value-equality-expression",
"path": "compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/1.3.kt",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-218",
"casesNumber": 0,
"description": "check value-equality-expression",
"path": "compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/1.4.kt",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-218",
"casesNumber": 0,
"description": "check value-equality-expression",
"path": "compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/1.5.kt",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-218",
"casesNumber": 0,
@@ -0,0 +1 @@
java.lang.IllegalStateException: TYPE_MISMATCH: Type mismatch: inferred type is Nothing? but Boolean was expected (7,21) in /KotlinClass.kt
@@ -0,0 +1,34 @@
// FULL_JDK
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX NOT LINKED SPEC TEST (NEGATIVE)
*
* SECTIONS: flexibility
* NUMBER: 1
* DESCRIPTION: check Nothing flexibillity
* EXCEPTION: compiletime
* 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: java.lang.IllegalStateException) {
"OK"
}
}
@@ -0,0 +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
@@ -0,0 +1,36 @@
// FULL_JDK
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX NOT LINKED SPEC TEST (NEGATIVE)
*
* SECTIONS: flexibility
* NUMBER: 2
* DESCRIPTION: check Nothing flexibillity
* EXCEPTION: compiletime
* 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() {
val v: Base<String> = Inheritor.default()
println(v.prop.length)
}
@@ -0,0 +1,34 @@
// !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"
}
}
@@ -0,0 +1,42 @@
// !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"
}
@@ -0,0 +1,26 @@
// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION
// SKIP_TXT
/*
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-220
* PLACE: expressions, comparison-expressions -> paragraph 1 -> sentence 2
* NUMBER: 1
* DESCRIPTION: <, >, <= and >= operators are overloadable
*/
// TESTCASE NUMBER: 1
class A(val a: Int) {
fun compareTo(other: A): Int = run {
this.a - other.a
}
}
fun case1() {
val a3 = A(-1)
val a4 = A(-3)
val x = (a3 <!OPERATOR_MODIFIER_REQUIRED!>><!> a4)
}
@@ -1,4 +1,16 @@
{
"1": {
"neg": {
"2": [
{
"specVersion": "0.1-220",
"casesNumber": 1,
"description": "\u003c, \u003e, \u003c\u003d and \u003e\u003d operators are overloadable",
"unexpectedBehaviour": false
}
]
}
},
"4": {
"neg": {
"1": [
@@ -612,6 +612,37 @@ public class DiagnosticsTestSpecGenerated extends AbstractDiagnosticsTestSpec {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/expressions/comparison-expressions"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("compiler/tests-spec/testData/diagnostics/linked/expressions/comparison-expressions/p-1")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class P_1 extends AbstractDiagnosticsTestSpec {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInP_1() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/expressions/comparison-expressions/p-1"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("compiler/tests-spec/testData/diagnostics/linked/expressions/comparison-expressions/p-1/neg")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Neg extends AbstractDiagnosticsTestSpec {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
@TestMetadata("2.1.kt")
public void test2_1() throws Exception {
runTest("compiler/tests-spec/testData/diagnostics/linked/expressions/comparison-expressions/p-1/neg/2.1.kt");
}
public void testAllFilesPresentInNeg() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/expressions/comparison-expressions/p-1/neg"), Pattern.compile("^(.+)\\.kt$"), true);
}
}
}
@TestMetadata("compiler/tests-spec/testData/diagnostics/linked/expressions/comparison-expressions/p-4")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -25,7 +25,7 @@ public class BlackBoxCodegenTestSpecGenerated extends AbstractBlackBoxCodegenTes
}
public void testAllFilesPresentInBox() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box"), Pattern.compile("^(.+)\\.kt$"), true, "helpers", "templates", "linked/declarations", "linked/statements", "linked/expressions/equality-expressions/reference-equality-expressions/p-1/neg", "linked/expressions/built-in-types-and-their-semantics/kotlin.unit/p-1/neg");
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box"), Pattern.compile("^(.+)\\.kt$"), true, "helpers", "templates", "notLinked/annotations/type-annotations/pos", "linked/declarations", "linked/statements", "linked/expressions/equality-expressions/reference-equality-expressions/p-1/neg", "linked/expressions/built-in-types-and-their-semantics/kotlin.unit/p-1/neg");
}
@TestMetadata("compiler/tests-spec/testData/codegen/box/linked")
@@ -315,24 +315,6 @@ public class BlackBoxCodegenTestSpecGenerated extends AbstractBlackBoxCodegenTes
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/comparison-expressions/p-1"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/comparison-expressions/p-1/neg")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Neg extends AbstractBlackBoxCodegenTestSpec {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
@TestMetadata("2.1.kt")
public void test2_1() throws Exception {
runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/comparison-expressions/p-1/neg/2.1.kt");
}
public void testAllFilesPresentInNeg() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/comparison-expressions/p-1/neg"), Pattern.compile("^(.+)\\.kt$"), true);
}
}
@TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/comparison-expressions/p-1/pos")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -420,6 +402,26 @@ public class BlackBoxCodegenTestSpecGenerated extends AbstractBlackBoxCodegenTes
runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/p-1/pos/2.4.kt");
}
@TestMetadata("2.5.kt")
public void test2_5() throws Exception {
runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/p-1/pos/2.5.kt");
}
@TestMetadata("2.6.kt")
public void test2_6() throws Exception {
runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/p-1/pos/2.6.kt");
}
@TestMetadata("2.7.kt")
public void test2_7() throws Exception {
runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/p-1/pos/2.7.kt");
}
@TestMetadata("2.8.kt")
public void test2_8() throws Exception {
runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/p-1/pos/2.8.kt");
}
public void testAllFilesPresentInPos() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/p-1/pos"), Pattern.compile("^(.+)\\.kt$"), true);
}
@@ -456,6 +458,42 @@ public class BlackBoxCodegenTestSpecGenerated extends AbstractBlackBoxCodegenTes
}
}
}
@TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/p-6")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class P_6 extends AbstractBlackBoxCodegenTestSpec {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInP_6() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/p-6"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/p-6/pos")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Pos extends AbstractBlackBoxCodegenTestSpec {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
@TestMetadata("1.1.kt")
public void test1_1() throws Exception {
runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/p-6/pos/1.1.kt");
}
@TestMetadata("1.2.kt")
public void test1_2() throws Exception {
runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/p-6/pos/1.2.kt");
}
public void testAllFilesPresentInPos() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/p-6/pos"), Pattern.compile("^(.+)\\.kt$"), true);
}
}
}
}
@TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals")
@@ -1249,6 +1287,11 @@ public class BlackBoxCodegenTestSpecGenerated extends AbstractBlackBoxCodegenTes
runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/reference-equality-expressions/p-3/pos/2.1.kt");
}
@TestMetadata("2.2.kt")
public void test2_2() throws Exception {
runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/reference-equality-expressions/p-3/pos/2.2.kt");
}
public void testAllFilesPresentInPos() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/reference-equality-expressions/p-3/pos"), Pattern.compile("^(.+)\\.kt$"), true);
}
@@ -1280,24 +1323,6 @@ public class BlackBoxCodegenTestSpecGenerated extends AbstractBlackBoxCodegenTes
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/neg")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Neg extends AbstractBlackBoxCodegenTestSpec {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
@TestMetadata("1.1.kt")
public void test1_1() throws Exception {
runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/neg/1.1.kt");
}
public void testAllFilesPresentInNeg() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/neg"), Pattern.compile("^(.+)\\.kt$"), true);
}
}
@TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -1311,6 +1336,51 @@ public class BlackBoxCodegenTestSpecGenerated extends AbstractBlackBoxCodegenTes
runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/1.1.kt");
}
@TestMetadata("1.2.kt")
public void test1_2() throws Exception {
runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/1.2.kt");
}
@TestMetadata("1.3.kt")
public void test1_3() throws Exception {
runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/1.3.kt");
}
@TestMetadata("1.4.kt")
public void test1_4() throws Exception {
runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/1.4.kt");
}
@TestMetadata("1.5.kt")
public void test1_5() throws Exception {
runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/1.5.kt");
}
@TestMetadata("2.1.kt")
public void test2_1() throws Exception {
runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/2.1.kt");
}
@TestMetadata("2.2.kt")
public void test2_2() throws Exception {
runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/2.2.kt");
}
@TestMetadata("2.3.kt")
public void test2_3() throws Exception {
runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/2.3.kt");
}
@TestMetadata("2.4.kt")
public void test2_4() throws Exception {
runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/2.4.kt");
}
@TestMetadata("2.5.kt")
public void test2_5() throws Exception {
runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/2.5.kt");
}
public void testAllFilesPresentInPos() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos"), Pattern.compile("^(.+)\\.kt$"), true);
}
@@ -3123,7 +3193,7 @@ public class BlackBoxCodegenTestSpecGenerated extends AbstractBlackBoxCodegenTes
}
public void testAllFilesPresentInNotLinked() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/notLinked"), Pattern.compile("^(.+)\\.kt$"), true);
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/notLinked"), Pattern.compile("^(.+)\\.kt$"), true, "annotations/type-annotations/pos");
}
@TestMetadata("compiler/tests-spec/testData/codegen/box/notLinked/annotations")
@@ -3135,7 +3205,7 @@ public class BlackBoxCodegenTestSpecGenerated extends AbstractBlackBoxCodegenTes
}
public void testAllFilesPresentInAnnotations() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/notLinked/annotations"), Pattern.compile("^(.+)\\.kt$"), true);
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/notLinked/annotations"), Pattern.compile("^(.+)\\.kt$"), true, "type-annotations/pos");
}
@TestMetadata("compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations")
@@ -3147,7 +3217,7 @@ public class BlackBoxCodegenTestSpecGenerated extends AbstractBlackBoxCodegenTes
}
public void testAllFilesPresentInType_annotations() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations"), Pattern.compile("^(.+)\\.kt$"), true);
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations"), Pattern.compile("^(.+)\\.kt$"), true, "pos");
}
@TestMetadata("compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations/neg")
@@ -3220,6 +3290,65 @@ public class BlackBoxCodegenTestSpecGenerated extends AbstractBlackBoxCodegenTes
}
}
@TestMetadata("compiler/tests-spec/testData/codegen/box/notLinked/flexibility")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Flexibility extends AbstractBlackBoxCodegenTestSpec {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInFlexibility() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/notLinked/flexibility"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("compiler/tests-spec/testData/codegen/box/notLinked/flexibility/neg")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Neg extends AbstractBlackBoxCodegenTestSpec {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
@TestMetadata("1.kt")
public void test1() throws Exception {
runTest("compiler/tests-spec/testData/codegen/box/notLinked/flexibility/neg/1.kt");
}
@TestMetadata("2.kt")
public void test2() throws Exception {
runTest("compiler/tests-spec/testData/codegen/box/notLinked/flexibility/neg/2.kt");
}
public void testAllFilesPresentInNeg() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/notLinked/flexibility/neg"), Pattern.compile("^(.+)\\.kt$"), true);
}
}
@TestMetadata("compiler/tests-spec/testData/codegen/box/notLinked/flexibility/pos")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Pos extends AbstractBlackBoxCodegenTestSpec {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
@TestMetadata("1.kt")
public void test1() throws Exception {
runTest("compiler/tests-spec/testData/codegen/box/notLinked/flexibility/pos/1.kt");
}
@TestMetadata("2.kt")
public void test2() throws Exception {
runTest("compiler/tests-spec/testData/codegen/box/notLinked/flexibility/pos/2.kt");
}
public void testAllFilesPresentInPos() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/notLinked/flexibility/pos"), Pattern.compile("^(.+)\\.kt$"), true);
}
}
}
@TestMetadata("compiler/tests-spec/testData/codegen/box/notLinked/objects")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)