[FIR] Add UNCHECKED_CAST

Regenerate diagnostics code
This commit is contained in:
Ivan Kochurkin
2021-09-16 23:24:58 +03:00
committed by TeamCityServer
parent 1fbccff1bd
commit d0a4ca199d
70 changed files with 118 additions and 933 deletions
@@ -5,11 +5,11 @@ fun foo(b: B<Int, Int>) {}
fun test_1(b: B<String, Number>) {
foo(b.myMap {
it.k.length // implicits
} as B<Int, Int>)
} <!UNCHECKED_CAST!>as B<Int, Int><!>)
}
fun test_2(s: String) {
val func = { s.length } <!CAST_NEVER_SUCCEEDS!>as<!> B<Int, Int>
val func = { s.length } <!UNCHECKED_CAST!>as B<Int, Int><!>
}
class B<out K, V>(val k: K, val v: V)
@@ -12,6 +12,6 @@ interface AbstractFirBasedSymbol<E> where E : FirSymbolOwner<E>, E : FirDeclarat
fun foo(firAdaptee: FirFunction<*>) {}
fun test(symbol: AbstractFirBasedSymbol<*>) {
val firAdaptee = symbol.fir as FirFunction
val firAdaptee = symbol.fir <!UNCHECKED_CAST!>as FirFunction<!> // TODO: KT-48832
foo(firAdaptee)
}
@@ -30,9 +30,9 @@ fun uExpression(): UExpressionPattern.Capture<UExpression> = expressionCapture(U
fun <T : UExpression> expressionCapture(clazz: Class<T>): UExpressionPattern.Capture<T> = UExpressionPattern.Capture(clazz)
open class UElementPattern<T : UElement, Self : UElementPattern<T, Self>>(clazz: Class<T>) : ObjectPattern<T, Self>(clazz) {
fun filter(filter: (T) -> Boolean): Self = this as Self
fun filter(filter: (T) -> Boolean): Self = this <!UNCHECKED_CAST!>as Self<!>
}
open class UExpressionPattern<T : UExpression, Self : UExpressionPattern<T, Self>>(clazz: Class<T>) : UElementPattern<T, Self>(clazz) {
open class Capture<T : UExpression>(clazz: Class<T>) : UExpressionPattern<T, Capture<T>>(clazz)
}
}
@@ -6,7 +6,7 @@ fun List<String>.modify() {
}
fun Any.modify() {
(<!VARIABLE_EXPECTED!>this as List<Int><!>) += 42
(<!VARIABLE_EXPECTED!>this <!UNCHECKED_CAST!>as List<Int><!><!>) += 42
}
operator fun <T> Set<T>.plusAssign(x: T) {}
@@ -17,5 +17,5 @@ fun Set<String>.modify() {
}
fun Any.modifySet() {
(this as Set<Int>) += 42
(this <!UNCHECKED_CAST!>as Set<Int><!>) += 42
}