Files
kotlin-fork/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromCompanionObject.kt
T
Dmitry Savvinov d570b863ce Introduce deprecation of companion objects nested classes
Introdude deprecation as per KT-21515. Warning is reported on type
usage, that soon will became invisible. Quickfix by adding explicit
import is added.

Idea behind implementation is to mark scopes that are deprecated (see
ClassResolutionScopesSupport).

Then, during walk along hierarchy of scopes, look at deprecation status
of the scope that has provided this classifier.
Note that we also have to check if there are *some* non-deprecated
visibility paths (because we can see classifier by two paths, e.g. if
we've added explicit import) -- then this type reference shouldn't be
treated as deprecated.
2018-02-21 16:04:49 +03:00

22 lines
585 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: <!DEPRECATED_ACCESS_BY_SHORT_NAME, OUTER_CLASS_ARGUMENTS_REQUIRED!>Inner<!><Int>) {
// Inner<Char>() call use companion as implicit receiver
val y: Outer<String>.Inner<Char> = Inner<Char>()
}
}