[FIR] Correctly detect super type in delegated constructor call
This commit is contained in:
+1
-1
@@ -5,7 +5,7 @@ class A : B {
|
||||
val myProp: Int = 1
|
||||
override val parentProp = 1
|
||||
|
||||
constructor(x: Int, y: Int = global): <!INAPPLICABLE_CANDIDATE!>super<!>(x + y + global) {
|
||||
constructor(x: Int, y: Int = global): super(x + y + global) {
|
||||
foo(x, y, myProp)
|
||||
x + y + myProp + parentProp + super.parentProp
|
||||
}
|
||||
|
||||
+1
-1
@@ -35,5 +35,5 @@ class A : B {
|
||||
// no cycle, just call to super constuctor
|
||||
constructor(x1: Double, x2: Double): this(x1, x2, 1.0)
|
||||
constructor(x1: Double, x2: Double, x3: Double): this(x1, x2, x3, 1.0)
|
||||
constructor(x1: Double, x2: Double, x3: Double, x4: Double): <!INAPPLICABLE_CANDIDATE!>super<!>(1.toByte())
|
||||
constructor(x1: Double, x2: Double, x3: Double, x4: Double): super(1.toByte())
|
||||
}
|
||||
|
||||
Vendored
+6
-6
@@ -2,8 +2,8 @@
|
||||
open class B0(x: Int)
|
||||
|
||||
class A0 : B0 {
|
||||
constructor()
|
||||
constructor(x: Int) : super()
|
||||
<!INAPPLICABLE_CANDIDATE!>constructor()<!>
|
||||
constructor(x: Int) : <!INAPPLICABLE_CANDIDATE!>super<!>()
|
||||
}
|
||||
|
||||
// --------------------------
|
||||
@@ -26,8 +26,8 @@ open class B2 {
|
||||
}
|
||||
|
||||
class A2 : B2 {
|
||||
constructor()
|
||||
constructor(x: Int) : super()
|
||||
<!INAPPLICABLE_CANDIDATE!>constructor()<!>
|
||||
constructor(x: Int) : <!INAPPLICABLE_CANDIDATE!>super<!>()
|
||||
}
|
||||
|
||||
// --------------------------
|
||||
@@ -37,6 +37,6 @@ open class B3 {
|
||||
}
|
||||
|
||||
class A3 : B3 {
|
||||
constructor()
|
||||
constructor(x: Int) : super()
|
||||
<!INAPPLICABLE_CANDIDATE!>constructor()<!>
|
||||
constructor(x: Int) : <!INAPPLICABLE_CANDIDATE!>super<!>()
|
||||
}
|
||||
@@ -6,14 +6,14 @@ open class B<T>(x: T, y: T) {
|
||||
|
||||
class A0 : B<String?> {
|
||||
constructor()
|
||||
constructor(x: String): <!INAPPLICABLE_CANDIDATE!>super<!>(x)
|
||||
constructor(x: String, y: String): <!INAPPLICABLE_CANDIDATE!>super<!>(x, y)
|
||||
constructor(x: String): super(x)
|
||||
constructor(x: String, y: String): super(x, y)
|
||||
}
|
||||
|
||||
class A1<R> : B<R> {
|
||||
constructor()
|
||||
constructor(x: R): <!INAPPLICABLE_CANDIDATE!>super<!>(x)
|
||||
constructor(x: R, y: R): <!INAPPLICABLE_CANDIDATE!>super<!>(x, y)
|
||||
constructor(x: R): super(x)
|
||||
constructor(x: R, y: R): super(x, y)
|
||||
}
|
||||
|
||||
class A2<R> {
|
||||
|
||||
@@ -13,14 +13,14 @@ class A0<T1, T2> {
|
||||
}
|
||||
|
||||
class A1<T1, T2> : B<T1, T2> {
|
||||
constructor(x: T1, y: T2): <!INAPPLICABLE_CANDIDATE!>super<!>(x, y)
|
||||
constructor(x: T1, y: T2): super(x, y)
|
||||
constructor(x: T1, y: Int): <!INAPPLICABLE_CANDIDATE!>super<!>(x, y)
|
||||
constructor(x: T1, y: T1, z: T1): <!INAPPLICABLE_CANDIDATE!>super<!>(x, y)
|
||||
}
|
||||
|
||||
class A2<T1, T2> : B<T1, Int> {
|
||||
constructor(x: T1, y: T2): <!INAPPLICABLE_CANDIDATE!>super<!>(x, y)
|
||||
constructor(x: T1, y: Int): <!INAPPLICABLE_CANDIDATE!>super<!>(x, y)
|
||||
constructor(x: T1, y: Int): super(x, y)
|
||||
constructor(x: T1, y: T1, z: T1): <!INAPPLICABLE_CANDIDATE!>super<!>(x, y)
|
||||
constructor(x: T1, y: T2, z: String): <!INAPPLICABLE_CANDIDATE!>super<!>(y, 1)
|
||||
}
|
||||
|
||||
@@ -6,11 +6,11 @@ open class B<X, Y : X> {
|
||||
}
|
||||
|
||||
class A<T1, T2 : T1> : B<T1, T2> {
|
||||
constructor(x: T1, y: T2): <!INAPPLICABLE_CANDIDATE!>super<!>(x, y)
|
||||
constructor(x: T2, y: T2, z: String): <!INAPPLICABLE_CANDIDATE!>super<!>(x, y)
|
||||
constructor(x: T1, y: T2): super(x, y)
|
||||
constructor(x: T2, y: T2, z: String): super(x, y)
|
||||
|
||||
constructor(x: T2, z: String, z1: String): <!INAPPLICABLE_CANDIDATE!>super<!>(x, "")
|
||||
constructor(x: T2, z: String, z1: String, z2: String): <!INAPPLICABLE_CANDIDATE!>super<!>(x, 1)
|
||||
constructor(x: T1, z: String, z1: String, z2: String, z3: String): <!INAPPLICABLE_CANDIDATE!>super<!>(x, "")
|
||||
constructor(x: T1, z: String, z1: String, z2: String, z3: String, z4: String): <!INAPPLICABLE_CANDIDATE!>super<!>(x, 1)
|
||||
constructor(x: T2, z: String, z1: String): super(x, "")
|
||||
constructor(x: T2, z: String, z1: String, z2: String): super(x, 1)
|
||||
constructor(x: T1, z: String, z1: String, z2: String, z3: String): super(x, "")
|
||||
constructor(x: T1, z: String, z1: String, z2: String, z3: String, z4: String): super(x, 1)
|
||||
}
|
||||
|
||||
+2
-2
@@ -6,7 +6,7 @@ open class Base<T>(p: Any?) {
|
||||
|
||||
class D: Base<Int>("") {
|
||||
inner class B : Base<String> {
|
||||
constructor() : <!INAPPLICABLE_CANDIDATE!>super<!>(<!INAPPLICABLE_CANDIDATE!>foo1<!>(""))
|
||||
constructor(x: Int) : <!INAPPLICABLE_CANDIDATE!>super<!>(foo1(1))
|
||||
constructor() : super(<!INAPPLICABLE_CANDIDATE!>foo1<!>(""))
|
||||
constructor(x: Int) : super(foo1(1))
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -6,8 +6,8 @@ open class Base<T>(p: Any?) {
|
||||
|
||||
class D: Base<Int>(1) {
|
||||
inner class B : Base<Int> {
|
||||
constructor() : <!INAPPLICABLE_CANDIDATE!>super<!>(foo1(1))
|
||||
constructor(x: Int) : <!INAPPLICABLE_CANDIDATE!>super<!>(this@B.<!UNRESOLVED_REFERENCE!>foo1<!>(1))
|
||||
constructor(x: Int, y: Int) : <!INAPPLICABLE_CANDIDATE!>super<!>(this@D.foo1(1))
|
||||
constructor() : super(foo1(1))
|
||||
constructor(x: Int) : super(this@B.<!UNRESOLVED_REFERENCE!>foo1<!>(1))
|
||||
constructor(x: Int, y: Int) : super(this@D.foo1(1))
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -5,8 +5,8 @@ open class Base(p: Any?) {
|
||||
|
||||
fun Base.foo() {
|
||||
class B : Base {
|
||||
constructor() : <!INAPPLICABLE_CANDIDATE!>super<!>(foo1())
|
||||
constructor(x: Int) : <!INAPPLICABLE_CANDIDATE!>super<!>(this@foo.foo1())
|
||||
constructor(x: Int, y: Int) : <!INAPPLICABLE_CANDIDATE!>super<!>(this@B.<!UNRESOLVED_REFERENCE!>foo1<!>())
|
||||
constructor() : super(foo1())
|
||||
constructor(x: Int) : super(this@foo.foo1())
|
||||
constructor(x: Int, y: Int) : super(this@B.<!UNRESOLVED_REFERENCE!>foo1<!>())
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -5,9 +5,9 @@ open class Base<T>(p: Any?) {
|
||||
|
||||
fun Base<Int>.foo() {
|
||||
class B : Base<String> {
|
||||
constructor() : <!INAPPLICABLE_CANDIDATE!>super<!>(<!INAPPLICABLE_CANDIDATE!>foo1<!>(""))
|
||||
constructor(x: Int) : <!INAPPLICABLE_CANDIDATE!>super<!>(foo1(1))
|
||||
constructor(x: Int, y: Int) : <!INAPPLICABLE_CANDIDATE!>super<!>(this@foo.foo1(12))
|
||||
constructor(x: Int, y: Int, z: Int) : <!INAPPLICABLE_CANDIDATE!>super<!>(this@B.<!UNRESOLVED_REFERENCE!>foo1<!>(""))
|
||||
constructor() : super(<!INAPPLICABLE_CANDIDATE!>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(this@B.<!UNRESOLVED_REFERENCE!>foo1<!>(""))
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -1,7 +1,7 @@
|
||||
open class C(val x: Int)
|
||||
|
||||
class D : C {
|
||||
constructor() : <!INAPPLICABLE_CANDIDATE!>super<!>(
|
||||
constructor() : super(
|
||||
{
|
||||
val s = ""
|
||||
<!UNRESOLVED_REFERENCE!>s<!>()
|
||||
|
||||
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)
|
||||
|
||||
class B : A {
|
||||
constructor(s: String)
|
||||
<!INAPPLICABLE_CANDIDATE!>constructor(s: String)<!>
|
||||
}
|
||||
|
||||
+1
-1
@@ -6,5 +6,5 @@ open class B(x: Double) {
|
||||
interface C
|
||||
class A : B, C {
|
||||
constructor(): <!INAPPLICABLE_CANDIDATE!>super<!>(' ')
|
||||
constructor(x: Int)
|
||||
<!INAPPLICABLE_CANDIDATE!>constructor(x: Int)<!>
|
||||
}
|
||||
|
||||
Vendored
-12
@@ -1,12 +0,0 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
fun <T> array(vararg x: T): Array<T> = null!!
|
||||
|
||||
open class B(vararg y: String) {
|
||||
constructor(x: Int): this(x.toString(), *array("1"), "2")
|
||||
}
|
||||
|
||||
class A : B {
|
||||
constructor(x: String, y: String): <!INAPPLICABLE_CANDIDATE!>super<!>(x, *array("3"), y)
|
||||
constructor(x: String): <!INAPPLICABLE_CANDIDATE!>super<!>(x)
|
||||
constructor(): super()
|
||||
}
|
||||
Vendored
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
fun <T> array(vararg x: T): Array<T> = null!!
|
||||
|
||||
|
||||
Vendored
-17
@@ -1,17 +0,0 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
fun <T> array(vararg x: T): Array<T> = null!!
|
||||
|
||||
open class B(x: Int) {
|
||||
constructor(vararg y: String): this(y[0].length)
|
||||
}
|
||||
|
||||
class A : B {
|
||||
constructor(x: String, y: String): <!INAPPLICABLE_CANDIDATE!>super<!>(x, *array("q"), y)
|
||||
constructor(x: String): <!INAPPLICABLE_CANDIDATE!>super<!>(x)
|
||||
constructor(): super()
|
||||
}
|
||||
|
||||
val b1 = B()
|
||||
val b2 = B("1", "2", "3")
|
||||
val b3 = B("1", *array("2", "3"), "4")
|
||||
val b4 = B(1)
|
||||
Vendored
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
fun <T> array(vararg x: T): Array<T> = null!!
|
||||
|
||||
|
||||
Reference in New Issue
Block a user