7ca84649d7
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
22 lines
552 B
Kotlin
Vendored
22 lines
552 B
Kotlin
Vendored
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
|
open class Outer<E> {
|
|
inner class Inner<F>
|
|
|
|
}
|
|
|
|
class Derived : Outer<String>() {
|
|
// Inner<Int> here means Outer<String>.Inner<Int>
|
|
fun foo(x: Inner<Int>) {}
|
|
}
|
|
|
|
class A {
|
|
companion object : Outer<String>()
|
|
|
|
// Does not work, could be Outer<String>.Inner<Int>
|
|
// TODO: Should work?
|
|
fun foo(x: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Inner<!><Int>) {
|
|
// Inner<Char>() call use companion as implicit receiver
|
|
val y: Outer<String>.Inner<Char> = Inner<Char>()
|
|
}
|
|
}
|