Files
kotlin-fork/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/secondLevelDepth.kt
T
Denis Zharkov 7ca84649d7 Fix implicit type arguments resolution for inner classes
When resolving arguments on inner classifier, one can omit the arguments
for outer class 'Outer' if they are present implicitly in the scope:
- One of the supertypes of current class is Outer
- One of the outer classes or one of their supertypes is Outer

Relevant arguments are obtained from the first type found by
the algorithm above

Note that before this commit implicit arguments were only been searched
in containing classes

 #KT-11123 Fixed
2016-09-15 10:33:19 +03:00

19 lines
367 B
Kotlin
Vendored

// !CHECK_TYPE
open class Outer<E> {
inner open class Inner<F> {
inner class Inner2<D> {
}
}
}
class DerivedOuter : Outer<String>() {
inner class DerivedInner : Inner<Int>() {
fun foo(): Inner2<Char> = null!!
}
}
fun foo() {
DerivedOuter().DerivedInner().foo() checkType { _<Outer<String>.Inner<Int>.Inner2<Char>>() }
}