Introduce FIR_IDENTICAL for FIR vs old frontend tests #KT-36879 Fixed
This commit is contained in:
Vendored
-42
@@ -1,42 +0,0 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
package my
|
||||
|
||||
// Accepts block, can't be distinguished from kotlin.contract without resolve
|
||||
fun contract(block: () -> Unit) {}
|
||||
|
||||
// Accepts int, potentially can be distinguished from kotlin.contract by PSI,
|
||||
// but as of Kotlin 1.3.0, we don't do that
|
||||
fun contract(i: Int) {}
|
||||
|
||||
fun doStuff() {}
|
||||
|
||||
class SomeClass {
|
||||
|
||||
fun contract() {}
|
||||
|
||||
fun callMemberContractWithThis() {
|
||||
this.contract()
|
||||
}
|
||||
|
||||
fun callMemberContractWithoutThis() {
|
||||
contract()
|
||||
}
|
||||
|
||||
fun callTopLevelSamePsiInMember() {
|
||||
contract { }
|
||||
}
|
||||
}
|
||||
|
||||
fun callTopLevelSamePsi() {
|
||||
contract { }
|
||||
}
|
||||
|
||||
fun callTopLevelDifferentPsi() {
|
||||
contract(42)
|
||||
}
|
||||
|
||||
fun callTopLevelSamePsiNotFirstStatement() {
|
||||
doStuff()
|
||||
contract { }
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
package my
|
||||
|
||||
-39
@@ -1,39 +0,0 @@
|
||||
// !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts
|
||||
// !LANGUAGE: +UseReturnsEffect
|
||||
// Issue: KT-26386
|
||||
|
||||
fun myRun(block: () -> Unit) {
|
||||
block()
|
||||
}
|
||||
|
||||
fun contract(block: () -> Unit) {
|
||||
block()
|
||||
}
|
||||
|
||||
fun case_1(): Boolean? {
|
||||
contract { case_1() }
|
||||
return null
|
||||
}
|
||||
|
||||
fun case_2(): Boolean? {
|
||||
contract { case_3() }
|
||||
return null
|
||||
}
|
||||
|
||||
fun case_3(): Boolean? {
|
||||
contract { case_2() }
|
||||
return null
|
||||
}
|
||||
|
||||
fun case4() {
|
||||
contract {
|
||||
myRun {
|
||||
val s: String
|
||||
run {
|
||||
s = "hello"
|
||||
}
|
||||
s.length
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts
|
||||
// !LANGUAGE: +UseReturnsEffect
|
||||
// Issue: KT-26386
|
||||
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
// !LANGUAGE: +AllowContractsForCustomFunctions +UseReturnsEffect
|
||||
// !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts
|
||||
// !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER
|
||||
|
||||
import kotlin.contracts.InvocationKind
|
||||
|
||||
inline fun foo(block: () -> Unit) {
|
||||
kotlin.contracts.contract {
|
||||
callsInPlace(block, InvocationKind.EXACTLY_ONCE)
|
||||
}
|
||||
block()
|
||||
}
|
||||
|
||||
fun main() {
|
||||
val x: Int
|
||||
foo {
|
||||
x = 42
|
||||
}
|
||||
println(x)
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !LANGUAGE: +AllowContractsForCustomFunctions +UseReturnsEffect
|
||||
// !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts
|
||||
// !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER
|
||||
|
||||
-10
@@ -1,10 +0,0 @@
|
||||
// See KT-28847
|
||||
|
||||
class Foo(val str: String?) {
|
||||
val first = run {
|
||||
str.isNullOrEmpty()
|
||||
second
|
||||
}
|
||||
|
||||
val second = str.isNullOrEmpty()
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// See KT-28847
|
||||
|
||||
class Foo(val str: String?) {
|
||||
|
||||
Reference in New Issue
Block a user