Move test to negatives after fix KT-26382

This commit is contained in:
victor.petukhov
2018-09-11 13:52:40 +03:00
parent 9bc5b753aa
commit cba99a1e67
4 changed files with 32 additions and 32 deletions
@@ -123,6 +123,15 @@ fun <T : Number?> T.case_10(): Boolean? {
return if (this@case_10 == null) true else null
}
fun <T : Number?> T.case_11_1(): Boolean? {
contract { returns(null) implies (this@case_11_1 != null) }
return if (this@case_11_1 != null) null else true
}
fun <T : Number?> T.case_11_2(): Boolean? {
contract { returns(null) implies (this@case_11_2 != null) }
return if (this@case_11_2 != null) null else true
}
// FILE: usages.kt
import contracts.*
@@ -190,3 +199,19 @@ fun case_10(value_1: Number?) {
<!UNREACHABLE_CODE!>println(<!><!DEBUG_INFO_SMARTCAST!>value_1<!><!UNREACHABLE_CODE!>.toByte())<!>
}
}
/*
ISSUES: KT-26382
*/
fun case_11(value_1: Number?, value_2: Number?) {
if (value_1?.case_11_1() == null) {
println(value_1<!UNSAFE_CALL!>.<!>toByte())
} else {
println(<!DEBUG_INFO_SMARTCAST!>value_1<!>.toByte())
}
if (value_2?.case_11_2() != null) {
println(<!DEBUG_INFO_SMARTCAST!>value_2<!>.toByte())
} else {
println(value_2<!UNSAFE_CALL!>.<!>toByte())
}
}
@@ -2,6 +2,7 @@ package
public fun case_1(/*0*/ value_1: kotlin.Any?): kotlin.Unit
public fun case_10(/*0*/ value_1: kotlin.Number?): kotlin.Unit
public fun case_11(/*0*/ value_1: kotlin.Number?, /*1*/ value_2: kotlin.Number?): kotlin.Unit
public fun case_2(/*0*/ value_1: kotlin.Number): kotlin.Unit
public fun case_3(/*0*/ value_1: kotlin.String?, /*1*/ value_2: kotlin.String?): kotlin.Unit
public fun case_4(/*0*/ value_1: kotlin.String?, /*1*/ value_2: kotlin.String?): kotlin.Unit
@@ -18,6 +19,12 @@ package contracts {
public fun </*0*/ T : kotlin.Number?> T.case_10(): kotlin.Boolean?
Returns(NOT_NULL) -> <this> == null
public fun </*0*/ T : kotlin.Number?> T.case_11_1(): kotlin.Boolean?
Returns(NULL) -> <this> != null
public fun </*0*/ T : kotlin.Number?> T.case_11_2(): kotlin.Boolean?
Returns(NULL) -> <this> != null
public fun </*0*/ T : kotlin.Number> T.case_2(): kotlin.Unit
Returns(WILDCARD) -> <this> !is Int
@@ -150,15 +150,6 @@ fun <T : Number?> T.case_9_2(): Boolean? {
return if (this@case_9_2 != null) null else true
}
fun <T : Number?> T.case_10_1(): Boolean? {
contract { returns(null) implies (this@case_10_1 != null) }
return if (this@case_10_1 != null) null else true
}
fun <T : Number?> T.case_10_2(): Boolean? {
contract { returns(null) implies (this@case_10_2 != null) }
return if (this@case_10_2 != null) null else true
}
// FILE: usages.kt
import contracts.*
@@ -247,19 +238,3 @@ fun case_9(value_1: Number?) {
if (value_1?.case_9_1() != null) println(<!DEBUG_INFO_SMARTCAST!>value_1<!>.toByte())
if (value_1?.case_9_2() != null) println(<!DEBUG_INFO_SMARTCAST!>value_1<!>.toByte())
}
/*
ISSUES: KT-26382
*/
fun case_10(value_1: Number?, value_2: Number?) {
if (value_1?.case_10_1() == null) {
println(value_1<!UNSAFE_CALL!>.<!>toByte())
} else {
println(<!DEBUG_INFO_SMARTCAST!>value_1<!>.toByte())
}
if (value_2?.case_10_2() != null) {
println(<!DEBUG_INFO_SMARTCAST!>value_2<!>.toByte())
} else {
println(value_2<!UNSAFE_CALL!>.<!>toByte())
}
}
@@ -1,7 +1,6 @@
package
public fun case_1(/*0*/ value_1: kotlin.Any?): kotlin.Unit
public fun case_10(/*0*/ value_1: kotlin.Number?, /*1*/ value_2: kotlin.Number?): kotlin.Unit
public fun case_2(/*0*/ value_1: kotlin.Number): kotlin.Unit
public fun case_3(/*0*/ value_1: kotlin.String?, /*1*/ value_2: kotlin.String?): kotlin.Unit
public fun case_4(/*0*/ value_1: kotlin.String?, /*1*/ value_2: kotlin.String?): kotlin.Unit
@@ -15,12 +14,6 @@ package contracts {
public fun </*0*/ T> T.case_1(): kotlin.Unit
Returns(WILDCARD) -> <this> is String
public fun </*0*/ T : kotlin.Number?> T.case_10_1(): kotlin.Boolean?
Returns(NULL) -> <this> != null
public fun </*0*/ T : kotlin.Number?> T.case_10_2(): kotlin.Boolean?
Returns(NULL) -> <this> != null
public fun </*0*/ T : kotlin.Number> T.case_2(): kotlin.Unit
Returns(WILDCARD) -> <this> is Int