Files
kotlin-fork/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/accessGenericBaseWithSameExtension.kt
T
Denis Zharkov 418034add3 Prohibit instance access before super call
- Before this change members just left unresolved as they were absent in the
  specific scope named scopeForSecondaryConstructorHeaderResolution that
  created just to prohibit such accesses.
- Now they are resolved the same way as other members, but diagnostic is
  repored by in-place injected CallChecker
- Drop obsolete type of class scope

 #KT-6995 Fixed
2015-03-27 20:15:00 +03:00

14 lines
446 B
Kotlin
Vendored

// !DIAGNOSTICS: -UNUSED_PARAMETER
open class Base<T>(p: Any?) {
fun foo1(t: T) {}
}
fun Base<Int>.foo() {
class B : Base<String> {
constructor() : super(<!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>foo1<!>(""))
constructor(x: Int) : super(foo1(1))
constructor(x: Int, y: Int) : super(this@foo.foo1(12))
constructor(x: Int, y: Int, z: Int) : super(<!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this@B<!>.foo1(""))
}
}