Add 'mute' concept: move tests with unexpected behaviour to the corresponding folder
This commit is contained in:
Vendored
+2
-8
@@ -42,10 +42,7 @@ object case_3 {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
UNEXPECTED BEHAVIOUR
|
||||
ISSUES: KT-26244
|
||||
*/
|
||||
// ISSUES: KT-26244
|
||||
class case_4 : _ClassLevel3() {
|
||||
fun <T : Number?>T.case_4_1(): Boolean {
|
||||
<!CONTRACT_NOT_ALLOWED!>contract<!> { returns(false) implies (<!USELESS_IS_CHECK!>this@case_4 !is _ClassLevel1<!>) }
|
||||
@@ -79,10 +76,7 @@ class case_4 : _ClassLevel3() {
|
||||
fun case_4_5() = _ClassLevel3().case_4_5_wrap()
|
||||
}
|
||||
|
||||
/*
|
||||
UNEXPECTED BEHAVIOUR
|
||||
ISSUES: KT-26244
|
||||
*/
|
||||
// ISSUES: KT-26244
|
||||
class case_5<T> : _ClassLevel5() {
|
||||
inner class case_5_1 {
|
||||
fun <K : Number?>K.case_5_1_1() {
|
||||
|
||||
Vendored
+27
@@ -0,0 +1,27 @@
|
||||
// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect
|
||||
// !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER
|
||||
// !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts
|
||||
|
||||
/*
|
||||
KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE)
|
||||
|
||||
SECTION: contracts
|
||||
CATEGORIES: declarations, contractFunction
|
||||
NUMBER: 3
|
||||
DESCRIPTION: Check that fun with contract and CallsInPlace effect is an inline function.
|
||||
UNEXPECTED BEHAVIOUR
|
||||
ISSUES: KT-26126
|
||||
*/
|
||||
|
||||
import kotlin.contracts.*
|
||||
|
||||
fun funWithContractExactlyOnce(block: () -> Unit) { // report about not-inline function is expected
|
||||
contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) }
|
||||
return block()
|
||||
}
|
||||
|
||||
fun case_1() {
|
||||
val value_1: Int
|
||||
funWithContractExactlyOnce { value_1 = 10 } // back-end exception
|
||||
value_1.inc()
|
||||
}
|
||||
compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractFunction/neg/3.txt
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
package
|
||||
|
||||
public fun case_1(): kotlin.Unit
|
||||
public fun funWithContractExactlyOnce(/*0*/ block: () -> kotlin.Unit): kotlin.Unit
|
||||
CallsInPlace(block, EXACTLY_ONCE)
|
||||
Vendored
+21
-11
@@ -1,4 +1,4 @@
|
||||
// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect
|
||||
// !LANGUAGE: +AllowContractsForCustomFunctions +UseReturnsEffect
|
||||
// !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER
|
||||
// !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts
|
||||
|
||||
@@ -8,20 +8,30 @@
|
||||
SECTION: contracts
|
||||
CATEGORIES: declarations, contractFunction
|
||||
NUMBER: 1
|
||||
DESCRIPTION: Check that fun with contract and CallsInPlace effect is an inline function.
|
||||
UNEXPECTED BEHAVIOUR
|
||||
ISSUES: KT-26126
|
||||
DESCRIPTION: Contract function usage before declaration it
|
||||
*/
|
||||
|
||||
import kotlin.contracts.*
|
||||
|
||||
fun funWithContractExactlyOnce(block: () -> Unit) { // report about not-inline function is expected
|
||||
contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) }
|
||||
return block()
|
||||
fun case_1_1(x: Any?) {
|
||||
if (case_1_2(x)) {
|
||||
<!DEBUG_INFO_SMARTCAST!>x<!>.length
|
||||
}
|
||||
}
|
||||
|
||||
fun case_1() {
|
||||
val value_1: Int
|
||||
funWithContractExactlyOnce { value_1 = 10 } // back-end exception
|
||||
value_1.inc()
|
||||
fun case_2_1(x: Number?) {
|
||||
case_2_2(x)
|
||||
println(<!DEBUG_INFO_SMARTCAST!>x<!>.toByte())
|
||||
}
|
||||
|
||||
fun case_1_2(x: Any?): Boolean {
|
||||
contract { returns(true) implies (x is String) }
|
||||
return x is String
|
||||
}
|
||||
|
||||
fun case_2_2(x: Any?) {
|
||||
contract { returns() implies(x != null) }
|
||||
if (x == null) throw Exception()
|
||||
}
|
||||
|
||||
|
||||
|
||||
compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractFunction/pos/1.txt
Vendored
+8
-3
@@ -1,5 +1,10 @@
|
||||
package
|
||||
|
||||
public fun case_1(): kotlin.Unit
|
||||
public fun funWithContractExactlyOnce(/*0*/ block: () -> kotlin.Unit): kotlin.Unit
|
||||
CallsInPlace(block, EXACTLY_ONCE)
|
||||
public fun case_1_1(/*0*/ x: kotlin.Any?): kotlin.Unit
|
||||
public fun case_1_2(/*0*/ x: kotlin.Any?): kotlin.Boolean
|
||||
Returns(TRUE) -> x is String
|
||||
|
||||
public fun case_2_1(/*0*/ x: kotlin.Number?): kotlin.Unit
|
||||
public fun case_2_2(/*0*/ x: kotlin.Any?): kotlin.Unit
|
||||
Returns(WILDCARD) -> x != null
|
||||
|
||||
|
||||
Reference in New Issue
Block a user