[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
@@ -220,6 +220,16 @@ sealed class ConeContractDescriptionError : ConeDiagnostic {
override val reason: String
get() = "$operation operator call is illegal in contract description"
}
class NotSelfTypeParameter(val symbol: FirTypeParameterSymbol) : ConeContractDescriptionError() {
override val reason: String
get() = "Type parameter ${symbol.name} does not belong to owner of contract"
}
class NotReifiedTypeParameter(val symbol: FirTypeParameterSymbol) : ConeContractDescriptionError() {
override val reason: String
get() = "Type parameter ${symbol.name} is not reified"
}
}
class ConeIllegalAnnotationError(val name: Name) : ConeDiagnostic {