[FIR] Move FirReturnsImpliesAnalyzer to the extended checkers

This commit is contained in:
Nikolay Lunyak
2023-06-27 16:57:19 +03:00
committed by Space Team
parent db720d375d
commit 884cd6c754
21 changed files with 67 additions and 120 deletions
@@ -27,9 +27,9 @@ class Foo {
}
fun A?.goodWithReceiver() {
<!WRONG_IMPLIES_CONDITION!>contract {
contract {
returns() implies (this@goodWithReceiver != null)
}<!>
}
}
fun A?.badWithReceiver() {
@@ -48,8 +48,8 @@ fun doWhileInContract(x: Any?) {
}
fun localValInContract(x: Any?) {
<!WRONG_IMPLIES_CONDITION!>contract {
contract {
<!ERROR_IN_CONTRACT_DESCRIPTION!>val y: Int = 42<!>
returns() implies (x is String)
}<!>
}
}
@@ -5,9 +5,9 @@
import kotlin.contracts.*
inline fun <reified T> referToReifiedGeneric(x: Any?) {
<!WRONG_IMPLIES_CONDITION!>contract {
contract {
returns() implies (x is T)
}<!>
}
}
class Generic<T> {
@@ -19,15 +19,15 @@ class Generic<T> {
}
fun referToSubstituted(x: Any?) {
<!WRONG_IMPLIES_CONDITION!>contract {
contract {
returns() implies (x is Generic<String>)
}<!>
}
}
fun referToSubstitutedWithStar(x: Any?) {
<!WRONG_IMPLIES_CONDITION!>contract {
contract {
returns() implies (x is Generic<*>)
}<!>
}
}
typealias GenericString = Generic<String>
@@ -35,19 +35,19 @@ typealias FunctionalType = () -> Unit
typealias SimpleType = Int
fun referToAliasedGeneric(x: Any?) {
<!WRONG_IMPLIES_CONDITION!>contract {
contract {
returns() implies (x is GenericString)
}<!>
}
}
fun referToAliasedFunctionType(x: Any?) {
<!WRONG_IMPLIES_CONDITION!>contract {
contract {
returns() implies (x is FunctionalType)
}<!>
}
}
fun referToAliasedSimpleType(x: Any?) {
<!WRONG_IMPLIES_CONDITION!>contract {
contract {
returns() implies (x is SimpleType)
}<!>
}
}
@@ -5,9 +5,9 @@
import kotlin.contracts.*
inline fun <reified T> referToReifiedGeneric(x: Any?) {
<!WRONG_IMPLIES_CONDITION!>contract {
contract {
returns() implies (x is T)
}<!>
}
}
class Generic<T> {
@@ -19,15 +19,15 @@ class Generic<T> {
}
fun referToSubstituted(x: Any?) {
<!WRONG_IMPLIES_CONDITION!>contract {
contract {
returns() implies (x is Generic<String>)
}<!>
}
}
fun referToSubstitutedWithStar(x: Any?) {
<!WRONG_IMPLIES_CONDITION!>contract {
contract {
returns() implies (x is Generic<*>)
}<!>
}
}
typealias GenericString = Generic<String>
@@ -35,19 +35,19 @@ typealias FunctionalType = () -> Unit
typealias SimpleType = Int
fun referToAliasedGeneric(x: Any?) {
<!WRONG_IMPLIES_CONDITION!>contract {
contract {
returns() implies (x is GenericString)
}<!>
}
}
fun referToAliasedFunctionType(x: Any?) {
<!WRONG_IMPLIES_CONDITION!>contract {
contract {
returns() implies (x is FunctionalType)
}<!>
}
}
fun referToAliasedSimpleType(x: Any?) {
<!WRONG_IMPLIES_CONDITION!>contract {
contract {
returns() implies (x is SimpleType)
}<!>
}
}