FIR: Rework delegation constructor calls resolution

Make it work independently of being called for inner class (as in FE 1.0)
This commit is contained in:
Denis Zharkov
2020-07-30 15:35:35 +03:00
parent db93b9052b
commit a5a93d00a7
27 changed files with 181 additions and 169 deletions
@@ -12,4 +12,4 @@ public class C {
class Foo : <!UNRESOLVED_REFERENCE!>Data<!>()
companion object : DerivedAbstract()
}
}
@@ -12,4 +12,4 @@ public class C {
class Foo : <!UNRESOLVED_REFERENCE!>Data<!>()
companion object : DerivedAbstract()
}
}
@@ -79,4 +79,4 @@ object MessageManager15 : Manager<Int> {
var <T : Int> T.y
get() = 10
set(value) {}
}
}
+1 -1
View File
@@ -6,7 +6,7 @@ abstract class A<T> {
public abstract fun bar(x: T)
public inner abstract class B<S> : A<B<S>>() {
public inner class C<U> : B<C<U>>()
public inner class C<U> : <!UNRESOLVED_REFERENCE!>B<C<U>><!>()
{
// Here B<C<U>> means A<A<A<T>.B<S>>.B<A<T>.B<S>.C<U>>>.B<A<A<T>.B<S>>.B<A<T>.B<S>.C<U>>.C<U>>
// while for being a correct override it should be A<A<T>.B<S>>.B<A<T>.B<S>.C<U>>
@@ -97,4 +97,4 @@ open class C : O.B() {
// DEPRECATED: Classifiers from supertypes of our own companion
open class r : <!UNRESOLVED_REFERENCE!>FromDelta<!>()
}
}
+1 -1
View File
@@ -16,4 +16,4 @@ class Some: <!UNRESOLVED_REFERENCE!>Test<!>()
package b.d
public open class Test
public open class Test
@@ -17,5 +17,5 @@ class A1<R> : B<R> {
}
class A2<R> {
constructor(t: R, i: Int) : <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(i, 1)
constructor(t: R, i: Int) : <!INAPPLICABLE_CANDIDATE!>this<!>(i, 1)
}
@@ -5,11 +5,11 @@ open class B<R1, R2>(x: R1, y: R2)
class A0<T1, T2> {
constructor(x: T1, y: T2): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(x, y)
constructor(x: T1, y: T2, z: T2): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(x, 1) // ok, delegates to constructor(x: T1, y: Int)
constructor(x: T1, y: T2, z: T2): this(x, 1) // ok, delegates to constructor(x: T1, y: Int)
constructor(x: T1, y: Int): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(x, "")
constructor(x: T1): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(x, 1)
constructor(x: T1, y: T2, z: String): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(y, x)
constructor(x: T1, y: Int): <!NONE_APPLICABLE!>this<!>(x, "")
constructor(x: T1): this(x, 1)
constructor(x: T1, y: T2, z: String): <!NONE_APPLICABLE!>this<!>(y, x)
}
class A1<T1, T2> : B<T1, T2> {
@@ -1,16 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
open class B<X, Y : X> {
constructor(x: X, y: Y)
constructor(x: X, s: String)
constructor(y: Y, i: Int) : this(y, "")
}
class A<T1, T2 : T1> : B<T1, T2> {
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): 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)
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
open class B<X, Y : X> {
constructor(x: X, y: Y)
@@ -1,5 +1,5 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
// !WITH_NEW_INFERENCE
class X<T>(val t: T) {
constructor(t: T, i: Int) : this(i)
}
constructor(t: T, i: Int) : <!INAPPLICABLE_CANDIDATE!>this<!>(i)
}
@@ -1,4 +1,4 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
class X<T> {
constructor(t: T, i: Int): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(i, 1)
constructor(t: T, i: Int): <!INAPPLICABLE_CANDIDATE!>this<!>(i, 1)
}
@@ -22,16 +22,16 @@ class Generic<T1> {
open inner class Generic<T2>
inner class Test1 : GI<T1>()
inner class Test2 : GIInt()
inner class Test2 : <!UNRESOLVED_REFERENCE!>GIInt<!>()
inner class Test3 : GIStar()
inner class Test3a : test.Generic<*>.Inner()
inner class Test4<T2> : GG<T1, T2>()
inner class Test5 : GG<T1, Int>()
inner class Test6 : GG<Int, T1>()
inner class Test7 : GG<Int, Int>()
inner class Test8 : GIntG<Int>()
inner class Test9 : GGInt<Int>()
inner class Test6 : <!UNRESOLVED_REFERENCE!>GG<Int, T1><!>()
inner class Test7 : <!UNRESOLVED_REFERENCE!>GG<Int, Int><!>()
inner class Test8 : <!UNRESOLVED_REFERENCE!>GIntG<Int><!>()
inner class Test9 : <!UNRESOLVED_REFERENCE!>GGInt<Int><!>()
inner class Test10 : GGInt<T1>()
inner class Test11 : GG<T1, Int> {
@@ -3,5 +3,5 @@ open class Ref<T>(var x: T)
typealias R<T> = Ref<T>
// Type inference SHOULD NOT work for type alias constructor in supertypes list
class Test1 : R(0)
class Test2 : R<Int>(0)
class Test1 : <!INAPPLICABLE_CANDIDATE!>R<!>(0)
class Test2 : R<Int>(0)