[FIR] Prohibit referencing type parameters in contracts ...

...if they are not reified or not belong to owner declaration of the contract

KT-57911
This commit is contained in:
Dmitriy Novozhilov
2023-04-12 17:44:51 +03:00
committed by Space Team
parent 5a92eb2c67
commit f8dc8057f0
13 changed files with 302 additions and 11 deletions
@@ -12,9 +12,9 @@ inline fun <reified T> referToReifiedGeneric(x: Any?) {
class Generic<T> {
fun referToCaptured(x: Any?) {
<!WRONG_IMPLIES_CONDITION!>contract {
returns() implies (x is T)
}<!>
contract {
<!ERROR_IN_CONTRACT_DESCRIPTION!>returns() implies (x is T)<!>
}
}
}
@@ -50,4 +50,4 @@ fun referToAliasedSimpleType(x: Any?) {
<!WRONG_IMPLIES_CONDITION!>contract {
returns() implies (x is SimpleType)
}<!>
}
}
@@ -12,9 +12,9 @@ inline fun <reified T> referToReifiedGeneric(x: Any?) {
class Generic<T> {
fun referToCaptured(x: Any?) {
<!WRONG_IMPLIES_CONDITION!>contract {
returns() implies (x is T)
}<!>
contract {
<!ERROR_IN_CONTRACT_DESCRIPTION!>returns() implies (x is T)<!>
}
}
}
@@ -50,4 +50,4 @@ fun referToAliasedSimpleType(x: Any?) {
<!WRONG_IMPLIES_CONDITION!>contract {
returns() implies (x is SimpleType)
}<!>
}
}