[FIR] Forbid generic type checks inside contracts in K2 as it is done in K1.
#KT-59922
This commit is contained in:
committed by
Space Team
parent
a35191706f
commit
5096fd266e
Vendored
+4
-4
@@ -13,14 +13,14 @@ inline fun <reified T> referToReifiedGeneric(x: Any?) {
|
||||
class Generic<T> {
|
||||
fun referToCaptured(x: Any?) {
|
||||
contract {
|
||||
<!ERROR_IN_CONTRACT_DESCRIPTION!>returns() implies (x is T)<!>
|
||||
<!ERROR_IN_CONTRACT_DESCRIPTION!>returns() implies (x is <!CANNOT_CHECK_FOR_ERASED!>T<!>)<!>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun referToSubstituted(x: Any?) {
|
||||
contract {
|
||||
returns() implies (x is Generic<String>)
|
||||
returns() implies (x is <!CANNOT_CHECK_FOR_ERASED!>Generic<String><!>)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,13 +36,13 @@ typealias SimpleType = Int
|
||||
|
||||
fun referToAliasedGeneric(x: Any?) {
|
||||
contract {
|
||||
returns() implies (x is GenericString)
|
||||
returns() implies (x is <!CANNOT_CHECK_FOR_ERASED!>GenericString<!>)
|
||||
}
|
||||
}
|
||||
|
||||
fun referToAliasedFunctionType(x: Any?) {
|
||||
contract {
|
||||
returns() implies (x is FunctionalType)
|
||||
returns() implies (x is <!CANNOT_CHECK_FOR_ERASED!>FunctionalType<!>)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+4
-4
@@ -13,14 +13,14 @@ inline fun <reified T> referToReifiedGeneric(x: Any?) {
|
||||
class Generic<T> {
|
||||
fun referToCaptured(x: Any?) {
|
||||
contract {
|
||||
<!ERROR_IN_CONTRACT_DESCRIPTION!>returns() implies (x is T)<!>
|
||||
<!ERROR_IN_CONTRACT_DESCRIPTION!>returns() implies (x is <!CANNOT_CHECK_FOR_ERASED!>T<!>)<!>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun referToSubstituted(x: Any?) {
|
||||
contract {
|
||||
returns() implies (x is Generic<String>)
|
||||
returns() implies (x is <!CANNOT_CHECK_FOR_ERASED!>Generic<String><!>)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,13 +36,13 @@ typealias SimpleType = Int
|
||||
|
||||
fun referToAliasedGeneric(x: Any?) {
|
||||
contract {
|
||||
returns() implies (x is GenericString)
|
||||
returns() implies (x is <!CANNOT_CHECK_FOR_ERASED!>GenericString<!>)
|
||||
}
|
||||
}
|
||||
|
||||
fun referToAliasedFunctionType(x: Any?) {
|
||||
contract {
|
||||
returns() implies (x is FunctionalType)
|
||||
returns() implies (x is <!CANNOT_CHECK_FOR_ERASED!>FunctionalType<!>)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user