Fix PROTECTED_CONSTRUCTOR_NOT_IN_SUPER_CALL diagnostic in new inference
This commit is contained in:
+1
-1
@@ -55,7 +55,7 @@ object ProtectedConstructorCallChecker : CallChecker {
|
|||||||
// And without ProtectedConstructorCallChecker such calls would be allowed only because they are performed within subclass
|
// And without ProtectedConstructorCallChecker such calls would be allowed only because they are performed within subclass
|
||||||
// of constructor owner
|
// of constructor owner
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
if (Visibilities.findInvisibleMember(Visibilities.FALSE_IF_PROTECTED, descriptor, scopeOwner) == actualConstructor) {
|
if (Visibilities.findInvisibleMember(Visibilities.FALSE_IF_PROTECTED, descriptor, scopeOwner) == actualConstructor.original) {
|
||||||
context.trace.report(Errors.PROTECTED_CONSTRUCTOR_NOT_IN_SUPER_CALL.on(reportOn, descriptor))
|
context.trace.report(Errors.PROTECTED_CONSTRUCTOR_NOT_IN_SUPER_CALL.on(reportOn, descriptor))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -6,5 +6,5 @@ open class Foo protected constructor()
|
|||||||
inline fun foo(f: () -> Unit) = object: Foo() {}
|
inline fun foo(f: () -> Unit) = object: Foo() {}
|
||||||
|
|
||||||
class A : Foo() {
|
class A : Foo() {
|
||||||
inline fun foo(f: () -> Unit) = <!OI;PROTECTED_CONSTRUCTOR_NOT_IN_SUPER_CALL!>Foo<!>()
|
inline fun foo(f: () -> Unit) = <!PROTECTED_CONSTRUCTOR_NOT_IN_SUPER_CALL!>Foo<!>()
|
||||||
}
|
}
|
||||||
+4
-4
@@ -8,14 +8,14 @@ open class A protected constructor(x: Int) {
|
|||||||
|
|
||||||
class B4 : A(1) {
|
class B4 : A(1) {
|
||||||
init {
|
init {
|
||||||
<!OI;PROTECTED_CONSTRUCTOR_NOT_IN_SUPER_CALL!>A<!>()
|
<!PROTECTED_CONSTRUCTOR_NOT_IN_SUPER_CALL!>A<!>()
|
||||||
<!OI;PROTECTED_CONSTRUCTOR_NOT_IN_SUPER_CALL!>A<!>(1)
|
<!PROTECTED_CONSTRUCTOR_NOT_IN_SUPER_CALL!>A<!>(1)
|
||||||
A(5.0)
|
A(5.0)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun foo() {
|
fun foo() {
|
||||||
<!OI;PROTECTED_CONSTRUCTOR_NOT_IN_SUPER_CALL!>A<!>()
|
<!PROTECTED_CONSTRUCTOR_NOT_IN_SUPER_CALL!>A<!>()
|
||||||
<!OI;PROTECTED_CONSTRUCTOR_NOT_IN_SUPER_CALL!>A<!>(1)
|
<!PROTECTED_CONSTRUCTOR_NOT_IN_SUPER_CALL!>A<!>(1)
|
||||||
A(5.0)
|
A(5.0)
|
||||||
|
|
||||||
object : A() {}
|
object : A() {}
|
||||||
|
|||||||
+1
-1
@@ -23,7 +23,7 @@ class MyDerived : MyClass(1.0) {
|
|||||||
val test4 = <!INVISIBLE_MEMBER!>MyAlias<!>(1)
|
val test4 = <!INVISIBLE_MEMBER!>MyAlias<!>(1)
|
||||||
val test4a = <!INVISIBLE_MEMBER!>MyClass<!>(1)
|
val test4a = <!INVISIBLE_MEMBER!>MyClass<!>(1)
|
||||||
val test5 = <!PROTECTED_CONSTRUCTOR_NOT_IN_SUPER_CALL!>MyAlias<!>("")
|
val test5 = <!PROTECTED_CONSTRUCTOR_NOT_IN_SUPER_CALL!>MyAlias<!>("")
|
||||||
val test5a = <!OI;PROTECTED_CONSTRUCTOR_NOT_IN_SUPER_CALL!>MyClass<!>("")
|
val test5a = <!PROTECTED_CONSTRUCTOR_NOT_IN_SUPER_CALL!>MyClass<!>("")
|
||||||
val test6 = MyAlias(1.0)
|
val test6 = MyAlias(1.0)
|
||||||
val test6a = MyClass(1.0)
|
val test6a = MyClass(1.0)
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user