Use the new type inference for top-level callable reference resolution
^KT-47797 Fixed ^KT-47987 Fixed ^KT-45034 Fixed ^KT-48446 Fixed ^KT-13934 Fixed
This commit is contained in:
-74
@@ -1,74 +0,0 @@
|
||||
// !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
|
||||
|
||||
import A.Base.Companion.FromABaseCompanion
|
||||
import B.Base.Companion.FromBBaseCompanion
|
||||
import C.Base.Companion.FromCBaseCompanion
|
||||
import D.Base.Companion.FromDBaseCompanion
|
||||
|
||||
// ===== Case 1: LHS is a class
|
||||
//
|
||||
object A {
|
||||
open class Base {
|
||||
companion object {
|
||||
class FromABaseCompanion {
|
||||
fun foo() = 42
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Derived : Base() {
|
||||
val a = FromABaseCompanion::foo
|
||||
}
|
||||
}
|
||||
|
||||
// ===== Case 2: LHS is a class with companion object, function comes from class
|
||||
|
||||
object B {
|
||||
open class Base {
|
||||
companion object {
|
||||
class FromBBaseCompanion {
|
||||
fun foo() = 42
|
||||
|
||||
companion object {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Derived : Base() {
|
||||
val a = FromBBaseCompanion::foo
|
||||
}
|
||||
}
|
||||
|
||||
// ==== Case 3: LHS is a class with companion object, function comes from companion
|
||||
|
||||
object C {
|
||||
open class Base {
|
||||
companion object {
|
||||
class FromCBaseCompanion {
|
||||
companion object {
|
||||
fun foo() = 42
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Derived : Base() {
|
||||
val a = FromCBaseCompanion::foo
|
||||
}
|
||||
}
|
||||
|
||||
// ==== Case 4: LHS is an object
|
||||
|
||||
object D {
|
||||
open class Base {
|
||||
companion object {
|
||||
object FromDBaseCompanion {
|
||||
fun foo() = 42
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Derived : Base() {
|
||||
val a = FromDBaseCompanion::foo
|
||||
}
|
||||
}
|
||||
Vendored
+2
-1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
|
||||
|
||||
import A.Base.Companion.FromABaseCompanion
|
||||
@@ -53,7 +54,7 @@ object C {
|
||||
}
|
||||
|
||||
class Derived : Base() {
|
||||
val a = FromCBaseCompanion::<!UNRESOLVED_REFERENCE!>foo<!>
|
||||
val a = FromCBaseCompanion::foo
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -118,7 +118,7 @@ public object C {
|
||||
|
||||
public final class Derived : C.Base {
|
||||
public constructor Derived()
|
||||
public final val a: [ERROR : Type for FromCBaseCompanion::foo]
|
||||
public final val a: kotlin.reflect.KFunction1<C.Base.Companion.FromCBaseCompanion, kotlin.Int>
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
-69
@@ -1,69 +0,0 @@
|
||||
// !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
|
||||
|
||||
// ===== Case 1: LHS is a class
|
||||
//
|
||||
object A {
|
||||
open class Base {
|
||||
companion object {
|
||||
class FromBaseCompanion {
|
||||
fun foo() = 42
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Derived : Base() {
|
||||
val a = A.Base.Companion.FromBaseCompanion::foo
|
||||
}
|
||||
}
|
||||
|
||||
// ===== Case 2: LHS is a class with companion object, function comes from class
|
||||
|
||||
object B {
|
||||
open class Base {
|
||||
companion object {
|
||||
class FromBaseCompanion {
|
||||
fun foo() = 42
|
||||
|
||||
companion object {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Derived : Base() {
|
||||
val a = B.Base.Companion.FromBaseCompanion::foo
|
||||
}
|
||||
}
|
||||
|
||||
// ==== Case 3: LHS is a class with companion object, function comes from companion
|
||||
|
||||
object C {
|
||||
open class Base {
|
||||
companion object {
|
||||
class FromBaseCompanion {
|
||||
companion object {
|
||||
fun foo() = 42
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Derived : Base() {
|
||||
val a = C.Base.Companion.FromBaseCompanion::foo
|
||||
}
|
||||
}
|
||||
|
||||
// ==== Case 4: LHS is an object
|
||||
|
||||
object D {
|
||||
open class Base {
|
||||
companion object {
|
||||
object FromBaseCompanion {
|
||||
fun foo() = 42
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Derived : Base() {
|
||||
val a = D.Base.Companion.FromBaseCompanion::foo
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
|
||||
|
||||
// ===== Case 1: LHS is a class
|
||||
@@ -48,7 +49,7 @@ object C {
|
||||
}
|
||||
|
||||
class Derived : Base() {
|
||||
val a = C.Base.Companion.FromBaseCompanion::<!UNRESOLVED_REFERENCE!>foo<!>
|
||||
val a = C.Base.Companion.FromBaseCompanion::foo
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -118,7 +118,7 @@ public object C {
|
||||
|
||||
public final class Derived : C.Base {
|
||||
public constructor Derived()
|
||||
public final val a: [ERROR : Type for C.Base.Companion.FromBaseCompanion::foo]
|
||||
public final val a: kotlin.reflect.KFunction1<C.Base.Companion.FromBaseCompanion, kotlin.Int>
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ object C {
|
||||
}
|
||||
|
||||
class Derived : Base() {
|
||||
val a = <!DEPRECATED_ACCESS_BY_SHORT_NAME!>FromBaseCompanion<!>::<!UNRESOLVED_REFERENCE!>foo<!>
|
||||
val a = <!DEPRECATED_ACCESS_BY_SHORT_NAME!>FromBaseCompanion<!>::foo
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -118,7 +118,7 @@ public object C {
|
||||
|
||||
public final class Derived : C.Base {
|
||||
public constructor Derived()
|
||||
public final val a: [ERROR : Type for FromBaseCompanion::foo]
|
||||
public final val a: kotlin.reflect.KFunction1<C.Base.Companion.FromBaseCompanion, kotlin.Int>
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
Reference in New Issue
Block a user