[FIR] Correctly detect super type in delegated constructor call
This commit is contained in:
+1
-1
@@ -13,6 +13,6 @@ class B1(x: List<String>) : A<CharSequence>("", x)
|
||||
class B2(x: List<Int>) : <!INAPPLICABLE_CANDIDATE!>A<CharSequence><!>("", x)
|
||||
|
||||
class C : A<CharSequence> {
|
||||
constructor(x: List<String>) : <!INAPPLICABLE_CANDIDATE!>super<!>("", x)
|
||||
constructor(x: List<String>) : super("", x)
|
||||
constructor(x: List<Int>, y: Int) : <!INAPPLICABLE_CANDIDATE!>super<!>("", x)
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -16,6 +16,6 @@ class B1(x: List<String>) : A<CharSequence>("", x)
|
||||
class B2(x: List<Int>) : <!INAPPLICABLE_CANDIDATE!>A<CharSequence><!>("", x)
|
||||
|
||||
class C : A<CharSequence> {
|
||||
constructor(x: List<String>) : <!INAPPLICABLE_CANDIDATE!>super<!>("", x)
|
||||
constructor(x: List<String>) : super("", x)
|
||||
constructor(x: List<Int>, y: Int) : <!INAPPLICABLE_CANDIDATE!>super<!>("", x)
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -8,7 +8,7 @@ expect open class A {
|
||||
}
|
||||
|
||||
expect class B : A {
|
||||
constructor(i: Int)
|
||||
<!INAPPLICABLE_CANDIDATE!>constructor(i: Int)<!>
|
||||
|
||||
constructor() : <!INAPPLICABLE_CANDIDATE!>super<!>("B")
|
||||
constructor() : super("B")
|
||||
}
|
||||
|
||||
@@ -4,9 +4,9 @@ package toplevelObjectDeclarations
|
||||
open fun foo() : Int = 1
|
||||
}
|
||||
|
||||
class T : Foo {}
|
||||
<!INAPPLICABLE_CANDIDATE!>class T : Foo {}<!>
|
||||
|
||||
object A : Foo {
|
||||
<!INAPPLICABLE_CANDIDATE!>object A<!> : Foo {
|
||||
val x : Int = 2
|
||||
|
||||
fun test() : Int {
|
||||
|
||||
@@ -70,5 +70,5 @@ class B : A("") {
|
||||
}
|
||||
|
||||
class C : A {
|
||||
constructor() : <!INAPPLICABLE_CANDIDATE!>super<!>("")
|
||||
constructor() : super("")
|
||||
}
|
||||
+1
-1
@@ -14,7 +14,7 @@ open class S(
|
||||
|
||||
class A : S {
|
||||
|
||||
constructor() : <!INAPPLICABLE_CANDIDATE!>super<!>(
|
||||
constructor() : super(
|
||||
foo(),
|
||||
Nested(),
|
||||
Inner(),
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@ class B2 : A() {}
|
||||
class B3 : A("") {}
|
||||
|
||||
class B4 : A {
|
||||
constructor() : <!INAPPLICABLE_CANDIDATE!>super<!>(1)
|
||||
constructor() : super(1)
|
||||
constructor(x: Int) : super()
|
||||
constructor(x: Int, y: Int) : <!INAPPLICABLE_CANDIDATE!>super<!>("")
|
||||
constructor(x: Int, y: Int) : super("")
|
||||
}
|
||||
|
||||
-19
@@ -1,19 +0,0 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
open class Outer {
|
||||
inner open class A protected constructor(x: Int) {
|
||||
protected constructor() : this(1)
|
||||
|
||||
protected constructor(x: String) : this(2)
|
||||
}
|
||||
|
||||
inner class B1 : A(1) {}
|
||||
inner class B2 : A() {}
|
||||
inner class B3 : A("") {}
|
||||
|
||||
inner class B4 : A {
|
||||
constructor() : <!INAPPLICABLE_CANDIDATE!>super<!>(1)
|
||||
constructor(x: Int) : super()
|
||||
constructor(x: Int, y: Int) : <!INAPPLICABLE_CANDIDATE!>super<!>("")
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
open class Outer {
|
||||
inner open class A protected constructor(x: Int) {
|
||||
|
||||
+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