[FIR] Refactor FirTypeResolverImpl.resolveUserType

Fix IndexOutOfBoundsException on an attempt to cast an element

to inner class with type parameter

^KT-60921 Fixed
This commit is contained in:
Ivan Kochurkin
2023-08-09 22:15:08 +02:00
committed by Space Team
parent 5cd9afbf73
commit 42e5e43302
10 changed files with 157 additions and 186 deletions
@@ -0,0 +1,20 @@
// FIR_IDENTICAL
// ISSUE: KT-60921
abstract class A<T> {
inner class B {
inner class C
fun f2(y: Any) {
if (y is B<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><*><!>.C) { }
if (y is B.C<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><*><!>) { }
if (y is B<*>.C<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><*><!>) { }
}
}
fun f1(x: Any) {
if (x is B<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><*><!>) { }
}
}
@@ -1,20 +0,0 @@
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER
import Outer.Inner
class Outer<E> {
inner class Inner
fun foo() {
class E
val x: Inner = Inner()
}
class Nested {
fun bar(x: <!OUTER_CLASS_ARGUMENTS_REQUIRED!>Inner<!>) {}
}
}
class E
fun bar(x: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Inner<!>) {}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER
import Outer.Inner