[FIR] Use tower to resolve delegated constructors, set dispatch receiver

This commit is contained in:
Mikhail Glukhikh
2020-04-10 18:29:14 +03:00
parent 0b8c497d2e
commit 457fb09e3a
60 changed files with 226 additions and 106 deletions
@@ -1,30 +0,0 @@
// !LANGUAGE: +NewInference
open class A<T1, T2> {
open inner class A1(val a1: T1)
open inner class A2(val a2: T2)
open fun f1(arg: T1) = arg
open fun f2(arg: T2) = arg
}
open class B<T> : A<T, Int>() {
open inner class B1(b1: T) : <!INAPPLICABLE_CANDIDATE!>A1<!>(b1)
open inner class B2(b2: Int) : <!INAPPLICABLE_CANDIDATE!>A2<!>(b2)
fun variableToKnownParameter(p: T): Int =
p as? Int ?: 0
inner class B3(b3: T) : <!INAPPLICABLE_CANDIDATE!>A2<!>(variableToKnownParameter(b3))
override fun f1(arg: T) = arg
override fun f2(arg: Int) = arg
}
class C : B<String>() {
inner class C1(c1: String): <!INAPPLICABLE_CANDIDATE!>B1<!>(c1)
inner class C2 : B2(15)
override fun f1(arg: String) = arg
override fun f2(arg: Int) = arg
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !LANGUAGE: +NewInference
open class A<T1, T2> {
@@ -1,9 +0,0 @@
// !LANGUAGE: +NewInference
abstract class TestType<V: Any> {
open inner class Inner(val item: V)
}
class Derived: TestType<Long>() {
inner class DerivedInner(item: Long): <!INAPPLICABLE_CANDIDATE!>Inner<!>(item)
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !LANGUAGE: +NewInference
abstract class TestType<V: Any> {
@@ -1,6 +1,6 @@
class Test {
@`InnerAnnotation` @InnerAnnotation
companion object : StaticClass(), InnerClass() {
companion object : StaticClass(), <!UNRESOLVED_REFERENCE!>InnerClass<!>() {
}
@@ -5,8 +5,8 @@ class TestSome<P> {
}
class Test {
companion object : InnerClass() {
val a = object: InnerClass() {
companion object : <!UNRESOLVED_REFERENCE!>InnerClass<!>() {
val a = object: <!UNRESOLVED_REFERENCE!>InnerClass<!>() {
}
fun more(): InnerClass {
@@ -5,8 +5,8 @@ class TestSome<P> {
}
class Test {
object Some : InnerClass() {
val a = object: InnerClass() {
object Some : <!UNRESOLVED_REFERENCE!>InnerClass<!>() {
val a = object: <!UNRESOLVED_REFERENCE!>InnerClass<!>() {
}
fun more(): InnerClass {
+1 -1
View File
@@ -7,7 +7,7 @@ class Outer {
class Nested1 : OpenNested()
class Nested2 : FinalNested()
class Nested3 : OpenInner()
class Nested3 : <!UNRESOLVED_REFERENCE!>OpenInner<!>()
class Nested4 : FinalInner()
inner class Inner1 : OpenNested()
@@ -2,6 +2,6 @@ class A {
open inner class Inner
class Nested : Inner {
constructor()
<!UNRESOLVED_REFERENCE!>constructor()<!>
}
}