FIR: forbid reporting inapplicable-likes on implicit constructors
This commit is contained in:
Vendored
+1
-1
@@ -63,5 +63,5 @@ class M {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class U : M {
|
class U : M {
|
||||||
constructor()<!INAPPLICABLE_CANDIDATE!><!>
|
constructor()
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -3,16 +3,16 @@ class A(x: Int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class B : A {
|
class B : A {
|
||||||
<!EXPLICIT_DELEGATION_CALL_REQUIRED!>constructor()<!><!NONE_APPLICABLE!><!>
|
<!EXPLICIT_DELEGATION_CALL_REQUIRED!>constructor()<!>
|
||||||
constructor(z: String) : this()
|
constructor(z: String) : this()
|
||||||
}
|
}
|
||||||
|
|
||||||
<!SUPERTYPE_INITIALIZED_WITHOUT_PRIMARY_CONSTRUCTOR!>class C : A(20) {
|
<!SUPERTYPE_INITIALIZED_WITHOUT_PRIMARY_CONSTRUCTOR!>class C : A(20) {
|
||||||
<!EXPLICIT_DELEGATION_CALL_REQUIRED!>constructor()<!><!NONE_APPLICABLE!><!>
|
<!EXPLICIT_DELEGATION_CALL_REQUIRED!>constructor()<!>
|
||||||
constructor(z: String) : this()
|
constructor(z: String) : this()
|
||||||
}<!>
|
}<!>
|
||||||
|
|
||||||
class D() : A(20) {
|
class D() : A(20) {
|
||||||
<!PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED!>constructor(x: Int)<!><!NONE_APPLICABLE!><!>
|
<!PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED!>constructor(x: Int)<!>
|
||||||
constructor(z: String) : this()
|
constructor(z: String) : this()
|
||||||
}
|
}
|
||||||
|
|||||||
+4
@@ -6,6 +6,7 @@
|
|||||||
package org.jetbrains.kotlin.fir.analysis.collectors.components
|
package org.jetbrains.kotlin.fir.analysis.collectors.components
|
||||||
|
|
||||||
import org.jetbrains.kotlin.KtNodeTypes
|
import org.jetbrains.kotlin.KtNodeTypes
|
||||||
|
import org.jetbrains.kotlin.fir.FirFakeSourceElementKind
|
||||||
import org.jetbrains.kotlin.fir.FirSourceElement
|
import org.jetbrains.kotlin.fir.FirSourceElement
|
||||||
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
|
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
|
||||||
import org.jetbrains.kotlin.fir.analysis.collectors.AbstractDiagnosticCollector
|
import org.jetbrains.kotlin.fir.analysis.collectors.AbstractDiagnosticCollector
|
||||||
@@ -73,6 +74,9 @@ class ErrorNodeDiagnosticCollectorComponent(collector: AbstractDiagnosticCollect
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (source.kind == FirFakeSourceElementKind.ImplicitConstructor) {
|
||||||
|
return
|
||||||
|
}
|
||||||
val coneDiagnostic = diagnostic.toFirDiagnostic(source)
|
val coneDiagnostic = diagnostic.toFirDiagnostic(source)
|
||||||
reporter.report(coneDiagnostic, context)
|
reporter.report(coneDiagnostic, context)
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
-1
@@ -8,7 +8,7 @@ expect open class A {
|
|||||||
}
|
}
|
||||||
|
|
||||||
expect class B : A {
|
expect class B : A {
|
||||||
<!EXPLICIT_DELEGATION_CALL_REQUIRED, NONE_APPLICABLE!>constructor(i: Int)<!>
|
<!EXPLICIT_DELEGATION_CALL_REQUIRED!>constructor(i: Int)<!>
|
||||||
|
|
||||||
constructor() : super("B")
|
constructor() : super("B")
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+3
-3
@@ -2,7 +2,7 @@
|
|||||||
open class B0(x: Int)
|
open class B0(x: Int)
|
||||||
|
|
||||||
class A0 : B0 {
|
class A0 : B0 {
|
||||||
<!INAPPLICABLE_CANDIDATE!>constructor()<!>
|
constructor()
|
||||||
constructor(x: Int) : <!INAPPLICABLE_CANDIDATE!>super<!>()
|
constructor(x: Int) : <!INAPPLICABLE_CANDIDATE!>super<!>()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ open class B2 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class A2 : B2 {
|
class A2 : B2 {
|
||||||
<!EXPLICIT_DELEGATION_CALL_REQUIRED, NONE_APPLICABLE!>constructor()<!>
|
<!EXPLICIT_DELEGATION_CALL_REQUIRED!>constructor()<!>
|
||||||
constructor(x: Int) : <!NONE_APPLICABLE!>super<!>()
|
constructor(x: Int) : <!NONE_APPLICABLE!>super<!>()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,6 +37,6 @@ open class B3 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class A3 : B3 {
|
class A3 : B3 {
|
||||||
<!HIDDEN!>constructor()<!>
|
constructor()
|
||||||
constructor(x: Int) : <!HIDDEN!>super<!>()
|
constructor(x: Int) : <!HIDDEN!>super<!>()
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
-7
@@ -1,7 +0,0 @@
|
|||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
|
||||||
open class A(p1: String)
|
|
||||||
|
|
||||||
class B() : A("") {
|
|
||||||
<!PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED!>constructor(s: String)<!><!INAPPLICABLE_CANDIDATE!><!> {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Vendored
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||||
open class A(p1: String)
|
open class A(p1: String)
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -2,6 +2,6 @@ class A {
|
|||||||
open inner class Inner
|
open inner class Inner
|
||||||
|
|
||||||
class Nested : Inner {
|
class Nested : Inner {
|
||||||
constructor()<!UNRESOLVED_REFERENCE!><!>
|
constructor()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
compiler/testData/diagnostics/tests/secondaryConstructors/reportResolutionErrorOnImplicitOnce.fir.kt
Vendored
+1
-1
@@ -2,5 +2,5 @@
|
|||||||
open class A(p1: String, p2: String, p3: String, p4: String, p5: String)
|
open class A(p1: String, p2: String, p3: String, p4: String, p5: String)
|
||||||
|
|
||||||
class B : A {
|
class B : A {
|
||||||
constructor(s: String)<!INAPPLICABLE_CANDIDATE!><!>
|
constructor(s: String)
|
||||||
}
|
}
|
||||||
|
|||||||
-10
@@ -1,10 +0,0 @@
|
|||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
|
||||||
open class B(x: Double) {
|
|
||||||
constructor(x: Int): this(1.0)
|
|
||||||
constructor(x: String): this(1.0)
|
|
||||||
}
|
|
||||||
interface C
|
|
||||||
class A : B, C {
|
|
||||||
constructor(): <!NONE_APPLICABLE!>super<!>(' ')
|
|
||||||
<!EXPLICIT_DELEGATION_CALL_REQUIRED, NONE_APPLICABLE!>constructor(x: Int)<!>
|
|
||||||
}
|
|
||||||
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||||
open class B(x: Double) {
|
open class B(x: Double) {
|
||||||
constructor(x: Int): this(1.0)
|
constructor(x: Int): this(1.0)
|
||||||
|
|||||||
Reference in New Issue
Block a user