[FIR] Implement bare type modification with known type arguments

This commit is contained in:
Mikhail Glukhikh
2020-02-10 10:56:59 +03:00
parent 28332933ce
commit e3721ed406
14 changed files with 79 additions and 24 deletions
@@ -6,5 +6,5 @@ interface G<T> : Tr<T>
fun test(tr: Tr<String>) {
val v = tr as G?
// If v is not nullable, there will be a warning on this line:
<!INAPPLICABLE_CANDIDATE!>checkSubtype<!><G<String>>(v!!)
checkSubtype<G<String>>(v!!)
}
@@ -9,7 +9,7 @@ class C2(val v2: Int)
fun _as_left(e: Either<C1, C2>): Any {
val v = e as Left
return <!INAPPLICABLE_CANDIDATE!>checkSubtype<!><Left<C1>>(v)
return checkSubtype<Left<C1>>(v)
}
fun _as_right(e: Either<C1, C2>): Any {
@@ -12,7 +12,7 @@ class C2(val v2: Int)
fun _is_l(e: Either<C1, C2>): Any {
if (e is Left) {
return e.value.<!UNRESOLVED_REFERENCE!>v1<!>
return e.value.v1
}
return e
}
@@ -14,7 +14,7 @@ fun _is_l(e: Either<C1, C2>): Any {
if (e !is Left) {
return e
}
return e.value.<!UNRESOLVED_REFERENCE!>v1<!>
return e.value.v1
}
fun _is_r(e: Either<C1, C2>): Any {
@@ -9,7 +9,7 @@ class C2(val v2: Int)
fun _as_left(e: Either<C1, C2>): Any? {
val v = e as? Left
return <!INAPPLICABLE_CANDIDATE!>checkSubtype<!><Left<C1>?>(v)
return checkSubtype<Left<C1>?>(v)
}
fun _as_right(e: Either<C1, C2>): Any? {
@@ -12,7 +12,7 @@ class C2(val v2: Int)
fun _when(e: Either<C1, C2>): Any {
return when (e) {
is Left -> e.value.<!UNRESOLVED_REFERENCE!>v1<!>
is Left -> e.value.v1
is Right -> e.value.<!UNRESOLVED_REFERENCE!>v2<!>
else -> e
}
@@ -5,5 +5,5 @@ interface G<T> : Tr<T>
fun test(tr: Tr<String>?) {
val v = tr as G
<!INAPPLICABLE_CANDIDATE!>checkSubtype<!><G<String>>(v)
checkSubtype<G<String>>(v)
}
@@ -6,5 +6,5 @@ interface G<T> : Tr<T>
fun test(tr: Tr<String>?) {
val v = tr as G?
// If v is not nullable, there will be a warning on this line:
<!INAPPLICABLE_CANDIDATE!>checkSubtype<!><G<String>>(v!!)
checkSubtype<G<String>>(v!!)
}