[FIR-TEST] Add new testdata generated after changes in previous commit
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
package toplevelObjectDeclarations
|
||||
|
||||
open class Foo(y : Int) {
|
||||
open fun foo() : Int = 1
|
||||
}
|
||||
|
||||
class T : Foo {}
|
||||
|
||||
object A : Foo {
|
||||
val x : Int = 2
|
||||
|
||||
fun test() : Int {
|
||||
return x + foo()
|
||||
}
|
||||
}
|
||||
|
||||
object B : A {}
|
||||
|
||||
val x = A.foo()
|
||||
|
||||
val y = object : Foo(x) {
|
||||
init {
|
||||
x + 12
|
||||
}
|
||||
|
||||
override fun foo() : Int = 1
|
||||
}
|
||||
|
||||
val z = y.foo()
|
||||
@@ -0,0 +1,5 @@
|
||||
package toplevelObjectDeclarations
|
||||
|
||||
object CObj {}
|
||||
|
||||
object DOjb : CObj {}
|
||||
@@ -0,0 +1,25 @@
|
||||
// NI_EXPECTED_FILE
|
||||
|
||||
package localObjects
|
||||
|
||||
object A {
|
||||
val x : Int = 0
|
||||
}
|
||||
|
||||
open class Foo {
|
||||
fun foo() : Int = 1
|
||||
}
|
||||
|
||||
fun test() {
|
||||
A.x
|
||||
val b = object : Foo() {
|
||||
}
|
||||
b.foo()
|
||||
|
||||
object B {
|
||||
fun foo() {}
|
||||
}
|
||||
B.foo()
|
||||
}
|
||||
|
||||
val bb = <!UNRESOLVED_REFERENCE!>B<!>.<!UNRESOLVED_REFERENCE!>foo<!>()
|
||||
@@ -0,0 +1,29 @@
|
||||
package nestedObejcts
|
||||
|
||||
object A {
|
||||
val b = B
|
||||
val d = A.B.A
|
||||
|
||||
object B {
|
||||
val a = A
|
||||
val e = B.A
|
||||
|
||||
object A {
|
||||
val a = A
|
||||
val b = B
|
||||
val x = nestedObejcts.A.B.A
|
||||
val y = this@A
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
object B {
|
||||
val b = B
|
||||
val c = A.B
|
||||
}
|
||||
|
||||
val a = A
|
||||
val b = B
|
||||
val c = A.B
|
||||
val d = A.B.A
|
||||
val e = B.<!UNRESOLVED_REFERENCE!>A<!>.<!UNRESOLVED_REFERENCE!>B<!>
|
||||
@@ -0,0 +1,9 @@
|
||||
object Obj {
|
||||
fun foo() {}
|
||||
|
||||
open fun bar() {}
|
||||
|
||||
var x: Int = 0
|
||||
|
||||
open var y: Int = 1
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
//no nested class access via instance reference error
|
||||
fun test() {
|
||||
A.Companion.<!INAPPLICABLE_CANDIDATE!>f<!>("")
|
||||
}
|
||||
|
||||
class A() {
|
||||
companion object {
|
||||
object f {
|
||||
operator fun invoke(i: Int) = i
|
||||
}
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
|
||||
|
||||
open class Base {
|
||||
companion object {
|
||||
annotation class Foo
|
||||
}
|
||||
}
|
||||
|
||||
class Derived : Base() {
|
||||
|
||||
@Foo
|
||||
fun foo() = 42
|
||||
}
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
// !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
|
||||
}
|
||||
}
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
// !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
|
||||
}
|
||||
}
|
||||
+142
@@ -0,0 +1,142 @@
|
||||
// !LANGUAGE: +ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
|
||||
// See KT-21515 for a class diagram and details
|
||||
|
||||
// class is to prevent accidental short-name import
|
||||
class O {
|
||||
open class Alpha {
|
||||
open fun foo() = 42
|
||||
|
||||
class FromAlpha {
|
||||
fun foo() = 42
|
||||
}
|
||||
|
||||
companion object {
|
||||
class FromCompanionAlpha {
|
||||
fun foo() = 42
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
open class Beta : Alpha() {
|
||||
override fun foo() = 42
|
||||
|
||||
class FromBeta {
|
||||
fun foo() = 42
|
||||
}
|
||||
|
||||
companion object {
|
||||
class FromCompanionBeta {
|
||||
fun foo() = 42
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
open class A {
|
||||
open fun foo() = 42
|
||||
|
||||
class FromA {
|
||||
fun foo() = 42
|
||||
}
|
||||
|
||||
companion object : Beta() {
|
||||
class FromCompanionA {
|
||||
fun foo() = 42
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////
|
||||
|
||||
open class FarAway {
|
||||
open fun foo() = 42
|
||||
|
||||
class FromFarAway {
|
||||
fun foo() = 42
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
open class Gamma {
|
||||
open fun foo() = 42
|
||||
|
||||
class FromGamma {
|
||||
fun foo() = 42
|
||||
}
|
||||
|
||||
companion object : FarAway() {
|
||||
class FromCompanionGamma {
|
||||
fun foo() = 42
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
open class B : A() {
|
||||
override fun foo() = 42
|
||||
|
||||
class FromB {
|
||||
fun foo() = 42
|
||||
}
|
||||
|
||||
companion object : Gamma() {
|
||||
override fun foo() = 42
|
||||
|
||||
class FromCompanionB {
|
||||
fun foo() = 42
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////
|
||||
|
||||
|
||||
open class Delta {
|
||||
open fun foo() = 42
|
||||
class FromDelta {
|
||||
fun foo() = 42
|
||||
}
|
||||
}
|
||||
|
||||
class C : O.B() {
|
||||
override fun foo() = 42
|
||||
|
||||
companion object : Delta() {
|
||||
class FromCompanionC {
|
||||
fun foo() = 42
|
||||
}
|
||||
}
|
||||
|
||||
// VISIBLE: Classifiers from direct superclasses
|
||||
val c = FromA::foo
|
||||
val d = FromB::foo
|
||||
|
||||
// VISIBLE: Classifiers from our own companion
|
||||
val n = FromCompanionC::foo
|
||||
|
||||
// INVISIBLE: direct superclasses themselves.
|
||||
val a = <!UNRESOLVED_REFERENCE!>A<!>::foo
|
||||
val b = <!UNRESOLVED_REFERENCE!>A<!>::foo
|
||||
|
||||
// DEPRECATED: Classifiers from companions of direct superclasses
|
||||
val e = FromCompanionA::foo
|
||||
val f = FromCompanionB::foo
|
||||
|
||||
// INVISIBLE: "cousin" supertypes themselves
|
||||
val g = <!UNRESOLVED_REFERENCE!>Alpha<!>::foo
|
||||
val h = <!UNRESOLVED_REFERENCE!>Beta<!>::foo
|
||||
val i = <!UNRESOLVED_REFERENCE!>Gamma<!>::foo
|
||||
|
||||
// DEPRECATED: classifiers from "cousin" superclasses
|
||||
val k = FromAlpha::foo
|
||||
val l = FromBeta::foo
|
||||
val m = FromGamma::foo
|
||||
|
||||
// INVISIBLE: We don't see classifiers from companions of "cousin" superclasses
|
||||
val o = <!UNRESOLVED_REFERENCE!>FromCompanionAlpha<!>::foo
|
||||
val p = <!UNRESOLVED_REFERENCE!>FromCompanionBeta<!>::foo
|
||||
val q = <!UNRESOLVED_REFERENCE!>FromCompanionGamma<!>::foo
|
||||
|
||||
// DEPRECATED: Classifiers from supertypes of our own companion
|
||||
val r = FromDelta::foo
|
||||
}
|
||||
+142
@@ -0,0 +1,142 @@
|
||||
// !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
|
||||
// See KT-21515 for a class diagram and details
|
||||
|
||||
// class is to prevent accidental short-name import
|
||||
class O {
|
||||
open class Alpha {
|
||||
open fun foo() = 42
|
||||
|
||||
class FromAlpha {
|
||||
fun foo() = 42
|
||||
}
|
||||
|
||||
companion object {
|
||||
class FromCompanionAlpha {
|
||||
fun foo() = 42
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
open class Beta : Alpha() {
|
||||
override fun foo() = 42
|
||||
|
||||
class FromBeta {
|
||||
fun foo() = 42
|
||||
}
|
||||
|
||||
companion object {
|
||||
class FromCompanionBeta {
|
||||
fun foo() = 42
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
open class A {
|
||||
open fun foo() = 42
|
||||
|
||||
class FromA {
|
||||
fun foo() = 42
|
||||
}
|
||||
|
||||
companion object : Beta() {
|
||||
class FromCompanionA {
|
||||
fun foo() = 42
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////
|
||||
|
||||
open class FarAway {
|
||||
open fun foo() = 42
|
||||
|
||||
class FromFarAway {
|
||||
fun foo() = 42
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
open class Gamma {
|
||||
open fun foo() = 42
|
||||
|
||||
class FromGamma {
|
||||
fun foo() = 42
|
||||
}
|
||||
|
||||
companion object : FarAway() {
|
||||
class FromCompanionGamma {
|
||||
fun foo() = 42
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
open class B : A() {
|
||||
override fun foo() = 42
|
||||
|
||||
class FromB {
|
||||
fun foo() = 42
|
||||
}
|
||||
|
||||
companion object : Gamma() {
|
||||
override fun foo() = 42
|
||||
|
||||
class FromCompanionB {
|
||||
fun foo() = 42
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////
|
||||
|
||||
|
||||
open class Delta {
|
||||
open fun foo() = 42
|
||||
class FromDelta {
|
||||
fun foo() = 42
|
||||
}
|
||||
}
|
||||
|
||||
class C : O.B() {
|
||||
override fun foo() = 42
|
||||
|
||||
companion object : Delta() {
|
||||
class FromCompanionC {
|
||||
fun foo() = 42
|
||||
}
|
||||
}
|
||||
|
||||
// VISIBLE: Classifiers from direct superclasses
|
||||
val c = FromA::foo
|
||||
val d = FromB::foo
|
||||
|
||||
// VISIBLE: Classifiers from our own companion
|
||||
val n = FromCompanionC::foo
|
||||
|
||||
// INVISIBLE: direct superclasses themselves.
|
||||
val a = <!UNRESOLVED_REFERENCE!>A<!>::foo
|
||||
val b = <!UNRESOLVED_REFERENCE!>A<!>::foo
|
||||
|
||||
// DEPRECATED: Classifiers from companions of direct superclasses
|
||||
val e = FromCompanionA::foo
|
||||
val f = FromCompanionB::foo
|
||||
|
||||
// INVISIBLE: "cousin" supertypes themselves
|
||||
val g = <!UNRESOLVED_REFERENCE!>Alpha<!>::foo
|
||||
val h = <!UNRESOLVED_REFERENCE!>Beta<!>::foo
|
||||
val i = <!UNRESOLVED_REFERENCE!>Gamma<!>::foo
|
||||
|
||||
// DEPRECATED: classifiers from "cousin" superclasses
|
||||
val k = FromAlpha::foo
|
||||
val l = FromBeta::foo
|
||||
val m = FromGamma::foo
|
||||
|
||||
// INVISIBLE: We don't see classifiers from companions of "cousin" superclasses
|
||||
val o = <!UNRESOLVED_REFERENCE!>FromCompanionAlpha<!>::foo
|
||||
val p = <!UNRESOLVED_REFERENCE!>FromCompanionBeta<!>::foo
|
||||
val q = <!UNRESOLVED_REFERENCE!>FromCompanionGamma<!>::foo
|
||||
|
||||
// DEPRECATED: Classifiers from supertypes of our own companion
|
||||
val r = FromDelta::foo
|
||||
}
|
||||
Vendored
+69
@@ -0,0 +1,69 @@
|
||||
// !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 = 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 = 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 = 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 = FromBaseCompanion::foo
|
||||
}
|
||||
}
|
||||
Vendored
+142
@@ -0,0 +1,142 @@
|
||||
// !LANGUAGE: +ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
|
||||
// See KT-21515 for a class diagram and details
|
||||
|
||||
// class is to prevent accidental short-name import
|
||||
class O {
|
||||
open class Alpha {
|
||||
open fun foo() = 42
|
||||
|
||||
class FromAlpha {
|
||||
fun foo() = 42
|
||||
}
|
||||
|
||||
companion object {
|
||||
class FromCompanionAlpha {
|
||||
fun foo() = 42
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
open class Beta : Alpha() {
|
||||
override fun foo() = 42
|
||||
|
||||
class FromBeta {
|
||||
fun foo() = 42
|
||||
}
|
||||
|
||||
companion object {
|
||||
class FromCompanionBeta {
|
||||
fun foo() = 42
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
open class A {
|
||||
open fun foo() = 42
|
||||
|
||||
class FromA {
|
||||
fun foo() = 42
|
||||
}
|
||||
|
||||
companion object : Beta() {
|
||||
class FromCompanionA {
|
||||
fun foo() = 42
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////
|
||||
|
||||
open class FarAway {
|
||||
open fun foo() = 42
|
||||
|
||||
class FromFarAway {
|
||||
fun foo() = 42
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
open class Gamma {
|
||||
open fun foo() = 42
|
||||
|
||||
class FromGamma {
|
||||
fun foo() = 42
|
||||
}
|
||||
|
||||
companion object : FarAway() {
|
||||
class FromCompanionGamma {
|
||||
fun foo() = 42
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
open class B : A() {
|
||||
override fun foo() = 42
|
||||
|
||||
class FromB {
|
||||
fun foo() = 42
|
||||
}
|
||||
|
||||
companion object : Gamma() {
|
||||
override fun foo() = 42
|
||||
|
||||
class FromCompanionB {
|
||||
fun foo() = 42
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////
|
||||
|
||||
|
||||
open class Delta {
|
||||
open fun foo() = 42
|
||||
class FromDelta {
|
||||
fun foo() = 42
|
||||
}
|
||||
}
|
||||
|
||||
class C : O.B() {
|
||||
override fun foo() = 42
|
||||
|
||||
companion object : Delta() {
|
||||
class FromCompanionC {
|
||||
fun foo() = 42
|
||||
}
|
||||
}
|
||||
|
||||
// VISIBLE: Classifiers from direct superclasses
|
||||
val c = O.A.FromA::foo
|
||||
val d = O.B.FromB::foo
|
||||
|
||||
// VISIBLE: Classifiers from our own companion
|
||||
val n = C.Companion.FromCompanionC::foo
|
||||
|
||||
// INVISIBLE: direct superclasses themselves.
|
||||
val a = O.A::foo
|
||||
val b = O.A::foo
|
||||
|
||||
// DEPRECATED: Classifiers from companions of direct superclasses
|
||||
val e = O.A.Companion.FromCompanionA::foo
|
||||
val f = O.B.Companion.FromCompanionB::foo
|
||||
|
||||
// INVISIBLE: "cousin" supertypes themselves
|
||||
val g = O.Alpha::foo
|
||||
val h = O.Beta::foo
|
||||
val i = O.Gamma::foo
|
||||
|
||||
// DEPRECATED: classifiers from "cousin" superclasses
|
||||
val k = O.Alpha.FromAlpha::foo
|
||||
val l = O.Beta.FromBeta::foo
|
||||
val m = O.Gamma.FromGamma::foo
|
||||
|
||||
// INVISIBLE: We don't see classifiers from companions of "cousin" superclasses
|
||||
val o = O.Alpha.Companion.FromCompanionAlpha::foo
|
||||
val p = O.Beta.Companion.FromCompanionBeta::foo
|
||||
val q = O.Gamma.Companion.FromCompanionGamma::foo
|
||||
|
||||
// DEPRECATED: Classifiers from supertypes of our own companion
|
||||
val r = Delta.FromDelta::foo
|
||||
}
|
||||
Vendored
+142
@@ -0,0 +1,142 @@
|
||||
// !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
|
||||
// See KT-21515 for a class diagram and details
|
||||
|
||||
// class is to prevent accidental short-name import
|
||||
class O {
|
||||
open class Alpha {
|
||||
open fun foo() = 42
|
||||
|
||||
class FromAlpha {
|
||||
fun foo() = 42
|
||||
}
|
||||
|
||||
companion object {
|
||||
class FromCompanionAlpha {
|
||||
fun foo() = 42
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
open class Beta : Alpha() {
|
||||
override fun foo() = 42
|
||||
|
||||
class FromBeta {
|
||||
fun foo() = 42
|
||||
}
|
||||
|
||||
companion object {
|
||||
class FromCompanionBeta {
|
||||
fun foo() = 42
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
open class A {
|
||||
open fun foo() = 42
|
||||
|
||||
class FromA {
|
||||
fun foo() = 42
|
||||
}
|
||||
|
||||
companion object : Beta() {
|
||||
class FromCompanionA {
|
||||
fun foo() = 42
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////
|
||||
|
||||
open class FarAway {
|
||||
open fun foo() = 42
|
||||
|
||||
class FromFarAway {
|
||||
fun foo() = 42
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
open class Gamma {
|
||||
open fun foo() = 42
|
||||
|
||||
class FromGamma {
|
||||
fun foo() = 42
|
||||
}
|
||||
|
||||
companion object : FarAway() {
|
||||
class FromCompanionGamma {
|
||||
fun foo() = 42
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
open class B : A() {
|
||||
override fun foo() = 42
|
||||
|
||||
class FromB {
|
||||
fun foo() = 42
|
||||
}
|
||||
|
||||
companion object : Gamma() {
|
||||
override fun foo() = 42
|
||||
|
||||
class FromCompanionB {
|
||||
fun foo() = 42
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////
|
||||
|
||||
|
||||
open class Delta {
|
||||
open fun foo() = 42
|
||||
class FromDelta {
|
||||
fun foo() = 42
|
||||
}
|
||||
}
|
||||
|
||||
class C : O.B() {
|
||||
override fun foo() = 42
|
||||
|
||||
companion object : Delta() {
|
||||
class FromCompanionC {
|
||||
fun foo() = 42
|
||||
}
|
||||
}
|
||||
|
||||
// VISIBLE: Classifiers from direct superclasses
|
||||
val c = O.A.FromA::foo
|
||||
val d = O.B.FromB::foo
|
||||
|
||||
// VISIBLE: Classifiers from our own companion
|
||||
val n = FromCompanionC::foo
|
||||
|
||||
// INVISIBLE: direct superclasses themselves.
|
||||
val a = O.A::foo
|
||||
val b = O.A::foo
|
||||
|
||||
// DEPRECATED: Classifiers from companions of direct superclasses
|
||||
val e = O.A.Companion.FromCompanionA::foo
|
||||
val f = O.B.Companion.FromCompanionB::foo
|
||||
|
||||
// INVISIBLE: "cousin" supertypes themselves
|
||||
val g = O.Alpha::foo
|
||||
val h = O.Beta::foo
|
||||
val i = O.Gamma::foo
|
||||
|
||||
// DEPRECATED: classifiers from "cousin" superclasses
|
||||
val k = O.Alpha.FromAlpha::foo
|
||||
val l = O.Beta.FromBeta::foo
|
||||
val m = O.Gamma.FromGamma::foo
|
||||
|
||||
// INVISIBLE: We don't see classifiers from companions of "cousin" superclasses
|
||||
val o = O.Alpha.Companion.FromCompanionAlpha::foo
|
||||
val p = O.Beta.Companion.FromCompanionBeta::foo
|
||||
val q = O.Gamma.Companion.FromCompanionGamma::foo
|
||||
|
||||
// DEPRECATED: Classifiers from supertypes of our own companion
|
||||
val r = Delta.FromDelta::foo
|
||||
}
|
||||
Vendored
+99
@@ -0,0 +1,99 @@
|
||||
// !LANGUAGE: +ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
|
||||
|
||||
// See KT-21515 for a class diagram and details
|
||||
|
||||
// Object is to prevent accidental short-name import
|
||||
object O {
|
||||
open class Alpha {
|
||||
class FromAlpha
|
||||
|
||||
companion object {
|
||||
class FromCompanionAlpha
|
||||
}
|
||||
}
|
||||
|
||||
open class Beta : Alpha() {
|
||||
class FromBeta
|
||||
|
||||
companion object {
|
||||
class FromCompanionBeta
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
open class A {
|
||||
class FromA
|
||||
|
||||
companion object : Beta() {
|
||||
class FromCompanionA
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////
|
||||
|
||||
open class FarAway {
|
||||
class FromFarAway
|
||||
|
||||
}
|
||||
|
||||
open class Gamma {
|
||||
class FromGamma
|
||||
companion object : FarAway() {
|
||||
class FromCompanionGamma
|
||||
}
|
||||
}
|
||||
|
||||
open class B : A() {
|
||||
class FromB
|
||||
|
||||
companion object : Gamma() {
|
||||
class FromCompanionB
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////
|
||||
|
||||
|
||||
open class Delta {
|
||||
class FromDelta
|
||||
}
|
||||
|
||||
class C : O.B() {
|
||||
companion object : Delta() {
|
||||
class FromCompanionC
|
||||
}
|
||||
|
||||
// VISIBLE: Classifiers from direct superclasses
|
||||
val c: FromA? = null
|
||||
val d: FromB? = null
|
||||
|
||||
// VISIBLE: Classifiers from our own companion
|
||||
val n: FromCompanionC? = null
|
||||
|
||||
// INVISIBLE: direct superclasses themselves.
|
||||
val a: A? = null
|
||||
val b: B? = null
|
||||
|
||||
// DEPRECATED: Classifiers from companions of direct superclasses
|
||||
val e: FromCompanionA? = null
|
||||
val f: FromCompanionB? = null
|
||||
|
||||
// INVISIBLE: "cousin" supertypes themselves
|
||||
val g: Alpha? = null
|
||||
val h: Beta? = null
|
||||
val i: Gamma? = null
|
||||
|
||||
// DEPRECATED: classifiers from "cousin" superclasses
|
||||
val k: FromAlpha? = null
|
||||
val l: FromBeta? = null
|
||||
val m: FromGamma? = null
|
||||
|
||||
// INVISIBLE: We don't see classifiers from companions of "cousin" superclasses
|
||||
val o: FromCompanionAlpha? = null
|
||||
val p: FromCompanionBeta? = null
|
||||
val q: FromCompanionGamma? = null
|
||||
|
||||
// DEPRECATED: Classifiers from supertypes of our own companion
|
||||
val r: FromDelta? = null
|
||||
}
|
||||
Vendored
+98
@@ -0,0 +1,98 @@
|
||||
// !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
|
||||
// See KT-21515 for a class diagram and details
|
||||
|
||||
// Object is to prevent accidental short-name import
|
||||
object O {
|
||||
open class Alpha {
|
||||
class FromAlpha
|
||||
|
||||
companion object {
|
||||
class FromCompanionAlpha
|
||||
}
|
||||
}
|
||||
|
||||
open class Beta : Alpha() {
|
||||
class FromBeta
|
||||
|
||||
companion object {
|
||||
class FromCompanionBeta
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
open class A {
|
||||
class FromA
|
||||
|
||||
companion object : Beta() {
|
||||
class FromCompanionA
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////
|
||||
|
||||
open class FarAway {
|
||||
class FromFarAway
|
||||
|
||||
}
|
||||
|
||||
open class Gamma {
|
||||
class FromGamma
|
||||
companion object : FarAway() {
|
||||
class FromCompanionGamma
|
||||
}
|
||||
}
|
||||
|
||||
open class B : A() {
|
||||
class FromB
|
||||
|
||||
companion object : Gamma() {
|
||||
class FromCompanionB
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////
|
||||
|
||||
|
||||
open class Delta {
|
||||
class FromDelta
|
||||
}
|
||||
|
||||
class C : O.B() {
|
||||
companion object : Delta() {
|
||||
class FromCompanionC
|
||||
}
|
||||
|
||||
// VISIBLE: Classifiers from direct superclasses
|
||||
val c: FromA? = null
|
||||
val d: FromB? = null
|
||||
|
||||
// VISIBLE: Classifiers from our own companion
|
||||
val n: FromCompanionC? = null
|
||||
|
||||
// INVISIBLE: direct superclasses themselves.
|
||||
val a: A? = null
|
||||
val b: B? = null
|
||||
|
||||
// DEPRECATED: Classifiers from companions of direct superclasses
|
||||
val e: FromCompanionA? = null
|
||||
val f: FromCompanionB? = null
|
||||
|
||||
// INVISIBLE: "cousin" supertypes themselves
|
||||
val g: Alpha? = null
|
||||
val h: Beta? = null
|
||||
val i: Gamma? = null
|
||||
|
||||
// DEPRECATED: classifiers from "cousin" superclasses
|
||||
val k: FromAlpha? = null
|
||||
val l: FromBeta? = null
|
||||
val m: FromGamma? = null
|
||||
|
||||
// INVISIBLE: We don't see classifiers from companions of "cousin" superclasses
|
||||
val o: FromCompanionAlpha? = null
|
||||
val p: FromCompanionBeta? = null
|
||||
val q: FromCompanionGamma? = null
|
||||
|
||||
// DEPRECATED: Classifiers from supertypes of our own companion
|
||||
val r: FromDelta? = null
|
||||
}
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
// !LANGUAGE: +ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
|
||||
|
||||
// See KT-21515 for a class diagram and details
|
||||
|
||||
// Object is to prevent accidental short-name import
|
||||
object O {
|
||||
open class Alpha {
|
||||
class FromAlpha
|
||||
|
||||
companion object {
|
||||
class FromCompanionAlpha
|
||||
}
|
||||
}
|
||||
|
||||
open class Beta : Alpha() {
|
||||
class FromBeta
|
||||
|
||||
companion object {
|
||||
class FromCompanionBeta
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
open class A {
|
||||
class FromA
|
||||
|
||||
companion object : Beta() {
|
||||
class FromCompanionA
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////
|
||||
|
||||
open class FarAway {
|
||||
class FromFarAway
|
||||
|
||||
}
|
||||
|
||||
open class Gamma {
|
||||
class FromGamma
|
||||
companion object : FarAway() {
|
||||
class FromCompanionGamma
|
||||
}
|
||||
}
|
||||
|
||||
open class B : A() {
|
||||
class FromB
|
||||
|
||||
companion object : Gamma() {
|
||||
class FromCompanionB
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////
|
||||
|
||||
|
||||
open class Delta {
|
||||
class FromDelta
|
||||
}
|
||||
|
||||
class C : O.B() {
|
||||
companion object : Delta() {
|
||||
class FromCompanionC
|
||||
}
|
||||
|
||||
// VISIBLE: Classifiers from direct superclasses
|
||||
val c: O.A.FromA? = null
|
||||
val d: O.B.FromB? = null
|
||||
|
||||
// VISIBLE: Classifiers from our own companion
|
||||
val n: C.Companion.FromCompanionC? = null
|
||||
|
||||
// INVISIBLE: direct superclasses themselves.
|
||||
val a: O.A? = null
|
||||
val b: O.B? = null
|
||||
|
||||
// DEPRECATED: Classifiers from companions of direct superclasses
|
||||
val e: O.A.Companion.FromCompanionA? = null
|
||||
val f: O.B.Companion.FromCompanionB? = null
|
||||
|
||||
// INVISIBLE: "cousin" supertypes themselves
|
||||
val g: O.Alpha? = null
|
||||
val h: O.Beta? = null
|
||||
val i: O.Gamma? = null
|
||||
|
||||
// DEPRECATED: classifiers from "cousin" superclasses
|
||||
val k: O.Alpha.FromAlpha? = null
|
||||
val l: O.Beta.FromBeta? = null
|
||||
val m: O.Gamma.FromGamma? = null
|
||||
|
||||
// INVISIBLE: We don't see classifiers from companions of "cousin" superclasses
|
||||
val o: O.Alpha.Companion.FromCompanionAlpha? = null
|
||||
val p: O.Beta.Companion.FromCompanionBeta? = null
|
||||
val q: O.Gamma.Companion.FromCompanionGamma? = null
|
||||
|
||||
// DEPRECATED: Classifiers from supertypes of our own companion
|
||||
val r: Delta.FromDelta? = null
|
||||
}
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
// !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
|
||||
// See KT-21515 for a class diagram and details
|
||||
|
||||
// Object is to prevent accidental short-name import
|
||||
object O {
|
||||
open class Alpha {
|
||||
class FromAlpha
|
||||
|
||||
companion object {
|
||||
class FromCompanionAlpha
|
||||
}
|
||||
}
|
||||
|
||||
open class Beta : Alpha() {
|
||||
class FromBeta
|
||||
|
||||
companion object {
|
||||
class FromCompanionBeta
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
open class A {
|
||||
class FromA
|
||||
|
||||
companion object : Beta() {
|
||||
class FromCompanionA
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////
|
||||
|
||||
open class FarAway {
|
||||
class FromFarAway
|
||||
|
||||
}
|
||||
|
||||
open class Gamma {
|
||||
class FromGamma
|
||||
companion object : FarAway() {
|
||||
class FromCompanionGamma
|
||||
}
|
||||
}
|
||||
|
||||
open class B : A() {
|
||||
class FromB
|
||||
|
||||
companion object : Gamma() {
|
||||
class FromCompanionB
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////
|
||||
|
||||
|
||||
open class Delta {
|
||||
class FromDelta
|
||||
}
|
||||
|
||||
class C : O.B() {
|
||||
companion object : Delta() {
|
||||
class FromCompanionC
|
||||
}
|
||||
|
||||
// VISIBLE: Classifiers from direct superclasses
|
||||
val c: O.A.FromA? = null
|
||||
val d: O.B.FromB? = null
|
||||
|
||||
// VISIBLE: Classifiers from our own companion
|
||||
val n: C.Companion.FromCompanionC? = null
|
||||
|
||||
// INVISIBLE: direct superclasses themselves.
|
||||
val a: O.A? = null
|
||||
val b: O.B? = null
|
||||
|
||||
// DEPRECATED: Classifiers from companions of direct superclasses
|
||||
val e: O.A.Companion.FromCompanionA? = null
|
||||
val f: O.B.Companion.FromCompanionB? = null
|
||||
|
||||
// INVISIBLE: "cousin" supertypes themselves
|
||||
val g: O.Alpha? = null
|
||||
val h: O.Beta? = null
|
||||
val i: O.Gamma? = null
|
||||
|
||||
// DEPRECATED: classifiers from "cousin" superclasses
|
||||
val k: O.Alpha.FromAlpha? = null
|
||||
val l: O.Beta.FromBeta? = null
|
||||
val m: O.Gamma.FromGamma? = null
|
||||
|
||||
// INVISIBLE: We don't see classifiers from companions of "cousin" superclasses
|
||||
val o: O.Alpha.Companion.FromCompanionAlpha? = null
|
||||
val p: O.Beta.Companion.FromCompanionBeta? = null
|
||||
val q: O.Gamma.Companion.FromCompanionGamma? = null
|
||||
|
||||
// DEPRECATED: Classifiers from supertypes of our own companion
|
||||
val r: Delta.FromDelta? = null
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
open class A {
|
||||
class FromA {
|
||||
fun foo() = 42
|
||||
}
|
||||
}
|
||||
|
||||
class B : A() {
|
||||
companion object : A() { }
|
||||
|
||||
// we're seeing FromA here by two paths: one is deprecated (via companion object), and another one is not,
|
||||
// so we shouldn't see deprecation warning
|
||||
val a: FromA? = null
|
||||
|
||||
val b = FromA::foo
|
||||
|
||||
val c = FromA()
|
||||
}
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
// !LANGUAGE: +ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
|
||||
// See KT-21515 for a open class diagram and details
|
||||
|
||||
// Object is to prevent accidental short-name import
|
||||
object O {
|
||||
open class Alpha {
|
||||
open class FromAlpha
|
||||
|
||||
companion object {
|
||||
open class FromCompanionAlpha
|
||||
}
|
||||
}
|
||||
|
||||
open class Beta : Alpha() {
|
||||
open class FromBeta
|
||||
|
||||
companion object {
|
||||
open class FromCompanionBeta
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
open class A {
|
||||
open class FromA
|
||||
|
||||
companion object : Beta() {
|
||||
open class FromCompanionA
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////
|
||||
|
||||
open class FarAway {
|
||||
open class FromFarAway
|
||||
|
||||
}
|
||||
|
||||
open class Gamma {
|
||||
open class FromGamma
|
||||
companion object : FarAway() {
|
||||
open class FromCompanionGamma
|
||||
}
|
||||
}
|
||||
|
||||
open class B : A() {
|
||||
open class FromB
|
||||
|
||||
companion object : Gamma() {
|
||||
open class FromCompanionB
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////
|
||||
|
||||
|
||||
open class Delta {
|
||||
open class FromDelta
|
||||
}
|
||||
|
||||
open class C : O.B() {
|
||||
companion object : Delta() {
|
||||
open class FromCompanionC
|
||||
}
|
||||
|
||||
// VISIBLE: Classifiers from direct superclasses
|
||||
open class c : FromA()
|
||||
open class d : FromB()
|
||||
|
||||
// VISIBLE: Classifiers from our own companion
|
||||
open class n : FromCompanionC()
|
||||
|
||||
// INVISIBLE: direct superclasses themselves.
|
||||
open class a : A()
|
||||
open class b : B()
|
||||
|
||||
// DEPRECATED: Classifiers from companions of direct superclasses
|
||||
open class e : FromCompanionA()
|
||||
open class f : FromCompanionB()
|
||||
|
||||
// INVISIBLE: "cousin" supertypes themselves
|
||||
open class g : Alpha()
|
||||
open class h : Beta()
|
||||
open class i : Gamma()
|
||||
|
||||
// DEPRECATED: classifiers from "cousin" superclasses
|
||||
open class k : FromAlpha()
|
||||
open class l : FromBeta()
|
||||
open class m : FromGamma()
|
||||
|
||||
// INVISIBLE: We don't see classifiers from companions of "cousin" superclasses
|
||||
open class o : FromCompanionAlpha()
|
||||
open class p : FromCompanionBeta()
|
||||
open class q : FromCompanionGamma()
|
||||
|
||||
// DEPRECATED: Classifiers from supertypes of our own companion
|
||||
open class r : FromDelta()
|
||||
}
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
// !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
|
||||
// See KT-21515 for a open class diagram and details
|
||||
|
||||
// Object is to prevent accidental short-name import
|
||||
object O {
|
||||
open class Alpha {
|
||||
open class FromAlpha
|
||||
|
||||
companion object {
|
||||
open class FromCompanionAlpha
|
||||
}
|
||||
}
|
||||
|
||||
open class Beta : Alpha() {
|
||||
open class FromBeta
|
||||
|
||||
companion object {
|
||||
open class FromCompanionBeta
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
open class A {
|
||||
open class FromA
|
||||
|
||||
companion object : Beta() {
|
||||
open class FromCompanionA
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////
|
||||
|
||||
open class FarAway {
|
||||
open class FromFarAway
|
||||
|
||||
}
|
||||
|
||||
open class Gamma {
|
||||
open class FromGamma
|
||||
companion object : FarAway() {
|
||||
open class FromCompanionGamma
|
||||
}
|
||||
}
|
||||
|
||||
open class B : A() {
|
||||
open class FromB
|
||||
|
||||
companion object : Gamma() {
|
||||
open class FromCompanionB
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////
|
||||
|
||||
|
||||
open class Delta {
|
||||
open class FromDelta
|
||||
}
|
||||
|
||||
open class C : O.B() {
|
||||
companion object : Delta() {
|
||||
open class FromCompanionC
|
||||
}
|
||||
|
||||
// VISIBLE: Classifiers from direct superclasses
|
||||
open class c : FromA()
|
||||
open class d : FromB()
|
||||
|
||||
// VISIBLE: Classifiers from our own companion
|
||||
open class n : FromCompanionC()
|
||||
|
||||
// INVISIBLE: direct superclasses themselves.
|
||||
open class a : A()
|
||||
open class b : B()
|
||||
|
||||
// DEPRECATED: Classifiers from companions of direct superclasses
|
||||
open class e : FromCompanionA()
|
||||
open class f : FromCompanionB()
|
||||
|
||||
// INVISIBLE: "cousin" supertypes themselves
|
||||
open class g : Alpha()
|
||||
open class h : Beta()
|
||||
open class i : Gamma()
|
||||
|
||||
// DEPRECATED: classifiers from "cousin" superclasses
|
||||
open class k : FromAlpha()
|
||||
open class l : FromBeta()
|
||||
open class m : FromGamma()
|
||||
|
||||
// INVISIBLE: We don't see classifiers from companions of "cousin" superclasses
|
||||
open class o : FromCompanionAlpha()
|
||||
open class p : FromCompanionBeta()
|
||||
open class q : FromCompanionGamma()
|
||||
|
||||
// DEPRECATED: Classifiers from supertypes of our own companion
|
||||
open class r : FromDelta()
|
||||
}
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
// !LANGUAGE: +ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
|
||||
// See KT-21515 for a open class diagram and details
|
||||
|
||||
// Object is to prevent accidental short-name import
|
||||
object O {
|
||||
open class Alpha {
|
||||
open class FromAlpha
|
||||
|
||||
companion object {
|
||||
open class FromCompanionAlpha
|
||||
}
|
||||
}
|
||||
|
||||
open class Beta : Alpha() {
|
||||
open class FromBeta
|
||||
|
||||
companion object {
|
||||
open class FromCompanionBeta
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
open class A {
|
||||
open class FromA
|
||||
|
||||
companion object : Beta() {
|
||||
open class FromCompanionA
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////
|
||||
|
||||
open class FarAway {
|
||||
open class FromFarAway
|
||||
|
||||
}
|
||||
|
||||
open class Gamma {
|
||||
open class FromGamma
|
||||
companion object : FarAway() {
|
||||
open class FromCompanionGamma
|
||||
}
|
||||
}
|
||||
|
||||
open class B : A() {
|
||||
open class FromB
|
||||
|
||||
companion object : Gamma() {
|
||||
open class FromCompanionB
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////
|
||||
|
||||
|
||||
open class Delta {
|
||||
open class FromDelta
|
||||
}
|
||||
|
||||
open class C : O.B() {
|
||||
companion object : Delta() {
|
||||
open class FromCompanionC
|
||||
}
|
||||
|
||||
// VISIBLE: Classifiers from direct superclasses
|
||||
open class c : O.A.FromA()
|
||||
open class d : O.B.FromB()
|
||||
|
||||
// VISIBLE: Classifiers from our own companion
|
||||
open class n : C.Companion.FromCompanionC()
|
||||
|
||||
// INVISIBLE: direct superclasses themselves.
|
||||
open class a : O.A()
|
||||
open class b : O.B()
|
||||
|
||||
// DEPRECATED: Classifiers from companions of direct superclasses
|
||||
open class e : O.A.Companion.FromCompanionA()
|
||||
open class f : O.B.Companion.FromCompanionB()
|
||||
|
||||
// INVISIBLE: "cousin" supertypes themselves
|
||||
open class g : O.Alpha()
|
||||
open class h : O.Beta()
|
||||
open class i : O.Gamma()
|
||||
|
||||
// DEPRECATED: classifiers from "cousin" superclasses
|
||||
open class k : O.Alpha.FromAlpha()
|
||||
open class l : O.Beta.FromBeta()
|
||||
open class m : O.Gamma.FromGamma()
|
||||
|
||||
// INVISIBLE: We don't see classifiers from companions of "cousin" superclasses
|
||||
open class o : O.Alpha.Companion.FromCompanionAlpha()
|
||||
open class p : O.Beta.Companion.FromCompanionBeta()
|
||||
open class q : O.Gamma.Companion.FromCompanionGamma()
|
||||
|
||||
// DEPRECATED: Classifiers from supertypes of our own companion
|
||||
open class r : Delta.FromDelta()
|
||||
}
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
// !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
|
||||
// See KT-21515 for a open class diagram and details
|
||||
|
||||
// Object is to prevent accidental short-name import
|
||||
object O {
|
||||
open class Alpha {
|
||||
open class FromAlpha
|
||||
|
||||
companion object {
|
||||
open class FromCompanionAlpha
|
||||
}
|
||||
}
|
||||
|
||||
open class Beta : Alpha() {
|
||||
open class FromBeta
|
||||
|
||||
companion object {
|
||||
open class FromCompanionBeta
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
open class A {
|
||||
open class FromA
|
||||
|
||||
companion object : Beta() {
|
||||
open class FromCompanionA
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////
|
||||
|
||||
open class FarAway {
|
||||
open class FromFarAway
|
||||
|
||||
}
|
||||
|
||||
open class Gamma {
|
||||
open class FromGamma
|
||||
companion object : FarAway() {
|
||||
open class FromCompanionGamma
|
||||
}
|
||||
}
|
||||
|
||||
open class B : A() {
|
||||
open class FromB
|
||||
|
||||
companion object : Gamma() {
|
||||
open class FromCompanionB
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////
|
||||
|
||||
|
||||
open class Delta {
|
||||
open class FromDelta
|
||||
}
|
||||
|
||||
open class C : O.B() {
|
||||
companion object : Delta() {
|
||||
open class FromCompanionC
|
||||
}
|
||||
|
||||
// VISIBLE: Classifiers from direct superclasses
|
||||
open class c : O.A.FromA()
|
||||
open class d : O.B.FromB()
|
||||
|
||||
// VISIBLE: Classifiers from our own companion
|
||||
open class n : C.Companion.FromCompanionC()
|
||||
|
||||
// INVISIBLE: direct superclasses themselves.
|
||||
open class a : O.A()
|
||||
open class b : O.B()
|
||||
|
||||
// DEPRECATED: Classifiers from companions of direct superclasses
|
||||
open class e : O.A.Companion.FromCompanionA()
|
||||
open class f : O.B.Companion.FromCompanionB()
|
||||
|
||||
// INVISIBLE: "cousin" supertypes themselves
|
||||
open class g : O.Alpha()
|
||||
open class h : O.Beta()
|
||||
open class i : O.Gamma()
|
||||
|
||||
// DEPRECATED: classifiers from "cousin" superclasses
|
||||
open class k : O.Alpha.FromAlpha()
|
||||
open class l : O.Beta.FromBeta()
|
||||
open class m : O.Gamma.FromGamma()
|
||||
|
||||
// INVISIBLE: We don't see classifiers from companions of "cousin" superclasses
|
||||
open class o : O.Alpha.Companion.FromCompanionAlpha()
|
||||
open class p : O.Beta.Companion.FromCompanionBeta()
|
||||
open class q : O.Gamma.Companion.FromCompanionGamma()
|
||||
|
||||
// DEPRECATED: Classifiers from supertypes of our own companion
|
||||
open class r : Delta.FromDelta()
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
// !LANGUAGE: +ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
// FILE: test/Java.java
|
||||
package test;
|
||||
|
||||
public class Java {
|
||||
public static void method() { }
|
||||
public static int property = 42;
|
||||
public static class Classifier { }
|
||||
public static void syntheticSam(Runnable r) { }
|
||||
|
||||
public static int getStaticSyntheticProperty() { return 42; }
|
||||
public static int setStaticSyntheticProperty(int x) { return 42; }
|
||||
|
||||
public int getInstanceSyntheticProperty() { return 42; }
|
||||
public int setInstanceSyntheticProperty(int x) { return 42; }
|
||||
}
|
||||
|
||||
// FILE: Kotlin.kt
|
||||
package test
|
||||
|
||||
open class Base {
|
||||
companion object : Java() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class Derived : Base() {
|
||||
fun test(javaStaticInTypePosition: Classifier) {
|
||||
<!UNRESOLVED_REFERENCE!>method<!>()
|
||||
<!UNRESOLVED_REFERENCE!>property<!>
|
||||
Classifier()
|
||||
<!UNRESOLVED_REFERENCE!>syntheticSam<!> { }
|
||||
|
||||
// Instance members shouldn't be affected, but we check them, just in case
|
||||
val y = <!UNRESOLVED_REFERENCE!>instanceSyntheticProperty<!>
|
||||
<!UNRESOLVED_REFERENCE!>instanceSyntheticProperty<!> = 43
|
||||
|
||||
// Note that statics actually aren't converted into synthetic property in Kotlin
|
||||
val x = <!UNRESOLVED_REFERENCE!>syntheticProperty<!>
|
||||
<!UNRESOLVED_REFERENCE!>syntheticProperty<!> = 42
|
||||
}
|
||||
|
||||
class JavaStaticInSupertypeList : Classifier() {
|
||||
|
||||
}
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
// !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
// FILE: test/Java.java
|
||||
package test;
|
||||
|
||||
public class Java {
|
||||
public static void method() { }
|
||||
public static int property = 42;
|
||||
public static class Classifier { }
|
||||
public static void syntheticSam(Runnable r) { }
|
||||
|
||||
public static int getStaticSyntheticProperty() { return 42; }
|
||||
public static int setStaticSyntheticProperty(int x) { return 42; }
|
||||
|
||||
public int getInstanceSyntheticProperty() { return 42; }
|
||||
public int setInstanceSyntheticProperty(int x) { return 42; }
|
||||
}
|
||||
|
||||
// FILE: Kotlin.kt
|
||||
package test
|
||||
|
||||
open class Base {
|
||||
companion object : Java() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class Derived : Base() {
|
||||
fun test(javaStaticInTypePosition: Classifier) {
|
||||
<!UNRESOLVED_REFERENCE!>method<!>()
|
||||
<!UNRESOLVED_REFERENCE!>property<!>
|
||||
Classifier()
|
||||
<!UNRESOLVED_REFERENCE!>syntheticSam<!> { }
|
||||
|
||||
// Instance members shouldn't be affected, but we check them, just in case
|
||||
val y = <!UNRESOLVED_REFERENCE!>instanceSyntheticProperty<!>
|
||||
<!UNRESOLVED_REFERENCE!>instanceSyntheticProperty<!> = 43
|
||||
|
||||
// Note that statics actually aren't converted into synthetic property in Kotlin
|
||||
val x = <!UNRESOLVED_REFERENCE!>syntheticProperty<!>
|
||||
<!UNRESOLVED_REFERENCE!>syntheticProperty<!> = 42
|
||||
}
|
||||
|
||||
class JavaStaticInSupertypeList : Classifier() {
|
||||
|
||||
}
|
||||
}
|
||||
Vendored
+53
@@ -0,0 +1,53 @@
|
||||
// !LANGUAGE: +ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
// FILE: test/Java.java
|
||||
package test;
|
||||
|
||||
public class Java {
|
||||
public static void method() { }
|
||||
public static int property = 42;
|
||||
public static class Classifier { }
|
||||
public static void syntheticSam(Runnable r) { }
|
||||
|
||||
public static int getStaticSyntheticProperty() { return 42; }
|
||||
public static int setStaticSyntheticProperty(int x) { return 42; }
|
||||
|
||||
public int getInstanceSyntheticProperty() { return 42; }
|
||||
public int setInstanceSyntheticProperty(int x) { return 42; }
|
||||
}
|
||||
|
||||
// FILE: Kotlin.kt
|
||||
package test
|
||||
|
||||
import test.Java.method
|
||||
import test.Java.Classifier
|
||||
import test.Java.property
|
||||
import test.Java.syntheticSam
|
||||
|
||||
open class Base {
|
||||
companion object : Java() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class Derived : Base() {
|
||||
fun test(javaStaticInTypePosition: Classifier) {
|
||||
method()
|
||||
property
|
||||
Classifier()
|
||||
syntheticSam { }
|
||||
|
||||
// Instance members shouldn't be affected, but we check them, just in case
|
||||
val y = <!UNRESOLVED_REFERENCE!>instanceSyntheticProperty<!>
|
||||
<!UNRESOLVED_REFERENCE!>instanceSyntheticProperty<!> = 43
|
||||
|
||||
// Note that statics actually aren't converted into synthetic property in Kotlin
|
||||
val x = <!UNRESOLVED_REFERENCE!>syntheticProperty<!>
|
||||
<!UNRESOLVED_REFERENCE!>syntheticProperty<!> = 42
|
||||
}
|
||||
|
||||
class JavaStaticInSupertypeList : Classifier() {
|
||||
|
||||
}
|
||||
}
|
||||
Vendored
+53
@@ -0,0 +1,53 @@
|
||||
// !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
// FILE: test/Java.java
|
||||
package test;
|
||||
|
||||
public class Java {
|
||||
public static void method() { }
|
||||
public static int property = 42;
|
||||
public static class Classifier { }
|
||||
public static void syntheticSam(Runnable r) { }
|
||||
|
||||
public static int getStaticSyntheticProperty() { return 42; }
|
||||
public static int setStaticSyntheticProperty(int x) { return 42; }
|
||||
|
||||
public int getInstanceSyntheticProperty() { return 42; }
|
||||
public int setInstanceSyntheticProperty(int x) { return 42; }
|
||||
}
|
||||
|
||||
// FILE: Kotlin.kt
|
||||
package test
|
||||
|
||||
import test.Java.method
|
||||
import test.Java.Classifier
|
||||
import test.Java.property
|
||||
import test.Java.syntheticSam
|
||||
|
||||
open class Base {
|
||||
companion object : Java() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class Derived : Base() {
|
||||
fun test(javaStaticInTypePosition: Classifier) {
|
||||
method()
|
||||
property
|
||||
Classifier()
|
||||
syntheticSam { }
|
||||
|
||||
// Instance members shouldn't be affected, but we check them, just in case
|
||||
val y = <!UNRESOLVED_REFERENCE!>instanceSyntheticProperty<!>
|
||||
<!UNRESOLVED_REFERENCE!>instanceSyntheticProperty<!> = 43
|
||||
|
||||
// Note that statics actually aren't converted into synthetic property in Kotlin
|
||||
val x = <!UNRESOLVED_REFERENCE!>syntheticProperty<!>
|
||||
<!UNRESOLVED_REFERENCE!>syntheticProperty<!> = 42
|
||||
}
|
||||
|
||||
class JavaStaticInSupertypeList : Classifier() {
|
||||
|
||||
}
|
||||
}
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
// !LANGUAGE: +ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
|
||||
// See KT-21515 for a class diagram and details
|
||||
|
||||
// Object is to prevent accidental short-name import
|
||||
object O {
|
||||
open class Alpha {
|
||||
class FromAlpha
|
||||
|
||||
companion object {
|
||||
class FromCompanionAlpha
|
||||
}
|
||||
}
|
||||
|
||||
open class Beta : Alpha() {
|
||||
class FromBeta
|
||||
|
||||
companion object {
|
||||
class FromCompanionBeta
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
open class A {
|
||||
class FromA
|
||||
|
||||
companion object : Beta() {
|
||||
class FromCompanionA
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////
|
||||
|
||||
open class FarAway {
|
||||
class FromFarAway
|
||||
|
||||
}
|
||||
|
||||
open class Gamma {
|
||||
class FromGamma
|
||||
companion object : FarAway() {
|
||||
class FromCompanionGamma
|
||||
}
|
||||
}
|
||||
|
||||
open class B : A() {
|
||||
class FromB
|
||||
|
||||
companion object : Gamma() {
|
||||
class FromCompanionB
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////
|
||||
|
||||
|
||||
open class Delta {
|
||||
class FromDelta
|
||||
}
|
||||
|
||||
class C : O.B() {
|
||||
companion object : Delta() {
|
||||
class FromCompanionC
|
||||
}
|
||||
|
||||
// VISIBLE: Classifiers from direct superclasses
|
||||
val c = FromA()
|
||||
val d = FromB()
|
||||
|
||||
// VISIBLE: Classifiers from our own companion
|
||||
val n = FromCompanionC()
|
||||
|
||||
// INVISIBLE: direct superclasses themselves.
|
||||
val a = <!UNRESOLVED_REFERENCE!>A<!>()
|
||||
val b = <!UNRESOLVED_REFERENCE!>B<!>()
|
||||
|
||||
// DEPRECATED: Classifiers from companions of direct superclasses
|
||||
val e = FromCompanionA()
|
||||
val f = FromCompanionB()
|
||||
|
||||
// INVISIBLE: "cousin" supertypes themselves
|
||||
val g = <!UNRESOLVED_REFERENCE!>Alpha<!>()
|
||||
val h = <!UNRESOLVED_REFERENCE!>Beta<!>()
|
||||
val i = <!UNRESOLVED_REFERENCE!>Gamma<!>()
|
||||
|
||||
// DEPRECATED: classifiers from "cousin" superclasses
|
||||
val k = FromAlpha()
|
||||
val l = FromBeta()
|
||||
val m = FromGamma()
|
||||
|
||||
// INVISIBLE: We don't see classifiers from companions of "cousin" superclasses
|
||||
val o = <!UNRESOLVED_REFERENCE!>FromCompanionAlpha<!>()
|
||||
val p = <!UNRESOLVED_REFERENCE!>FromCompanionBeta<!>()
|
||||
val q = <!UNRESOLVED_REFERENCE!>FromCompanionGamma<!>()
|
||||
|
||||
// DEPRECATED: Classifiers from supertypes of our own companion
|
||||
val r = FromDelta()
|
||||
}
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
// !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
|
||||
// See KT-21515 for a class diagram and details
|
||||
|
||||
// Object is to prevent accidental short-name import
|
||||
object O {
|
||||
open class Alpha {
|
||||
class FromAlpha
|
||||
|
||||
companion object {
|
||||
class FromCompanionAlpha
|
||||
}
|
||||
}
|
||||
|
||||
open class Beta : Alpha() {
|
||||
class FromBeta
|
||||
|
||||
companion object {
|
||||
class FromCompanionBeta
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
open class A {
|
||||
class FromA
|
||||
|
||||
companion object : Beta() {
|
||||
class FromCompanionA
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////
|
||||
|
||||
open class FarAway {
|
||||
class FromFarAway
|
||||
}
|
||||
|
||||
open class Gamma {
|
||||
class FromGamma
|
||||
companion object : FarAway() {
|
||||
class FromCompanionGamma
|
||||
}
|
||||
}
|
||||
|
||||
open class B : A() {
|
||||
class FromB
|
||||
|
||||
companion object : Gamma() {
|
||||
class FromCompanionB
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////
|
||||
|
||||
|
||||
open class Delta {
|
||||
class FromDelta
|
||||
}
|
||||
|
||||
class C : O.B() {
|
||||
companion object : Delta() {
|
||||
class FromCompanionC
|
||||
}
|
||||
|
||||
// VISIBLE: Classifiers from direct superclasses
|
||||
val c = FromA()
|
||||
val d = FromB()
|
||||
|
||||
// VISIBLE: Classifiers from our own companion
|
||||
val n = FromCompanionC()
|
||||
|
||||
// INVISIBLE: direct superclasses themselves.
|
||||
val a = <!UNRESOLVED_REFERENCE!>A<!>()
|
||||
val b = <!UNRESOLVED_REFERENCE!>B<!>()
|
||||
|
||||
// DEPRECATED: Classifiers from companions of direct superclasses
|
||||
val e = FromCompanionA()
|
||||
val f = FromCompanionB()
|
||||
|
||||
// INVISIBLE: "cousin" supertypes themselves
|
||||
val g = <!UNRESOLVED_REFERENCE!>Alpha<!>()
|
||||
val h = <!UNRESOLVED_REFERENCE!>Beta<!>()
|
||||
val i = <!UNRESOLVED_REFERENCE!>Gamma<!>()
|
||||
|
||||
// DEPRECATED: classifiers from "cousin" superclasses
|
||||
val k = FromAlpha()
|
||||
val l = FromBeta()
|
||||
val m = FromGamma()
|
||||
|
||||
// INVISIBLE: We don't see classifiers from companions of "cousin" superclasses
|
||||
val o = <!UNRESOLVED_REFERENCE!>FromCompanionAlpha<!>()
|
||||
val p = <!UNRESOLVED_REFERENCE!>FromCompanionBeta<!>()
|
||||
val q = <!UNRESOLVED_REFERENCE!>FromCompanionGamma<!>()
|
||||
|
||||
// DEPRECATED: Classifiers from supertypes of our own companion
|
||||
val r = FromDelta()
|
||||
}
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
// !LANGUAGE: +ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
|
||||
// See KT-21515 for a class diagram and details
|
||||
|
||||
// Object is to prevent accidental short-name import
|
||||
object O {
|
||||
open class Alpha {
|
||||
class FromAlpha
|
||||
|
||||
companion object {
|
||||
class FromCompanionAlpha
|
||||
}
|
||||
}
|
||||
|
||||
open class Beta : Alpha() {
|
||||
class FromBeta
|
||||
|
||||
companion object {
|
||||
class FromCompanionBeta
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
open class A {
|
||||
class FromA
|
||||
|
||||
companion object : Beta() {
|
||||
class FromCompanionA
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////
|
||||
|
||||
open class FarAway {
|
||||
class FromFarAway
|
||||
|
||||
}
|
||||
|
||||
open class Gamma {
|
||||
class FromGamma
|
||||
companion object : FarAway() {
|
||||
class FromCompanionGamma
|
||||
}
|
||||
}
|
||||
|
||||
open class B : A() {
|
||||
class FromB
|
||||
|
||||
companion object : Gamma() {
|
||||
class FromCompanionB
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////
|
||||
|
||||
|
||||
open class Delta {
|
||||
class FromDelta
|
||||
}
|
||||
|
||||
class C : O.B() {
|
||||
companion object : Delta() {
|
||||
class FromCompanionC
|
||||
}
|
||||
|
||||
// VISIBLE: Classifiers from direct superclasses
|
||||
val c = O.A.FromA()
|
||||
val d = O.B.FromB()
|
||||
|
||||
// VISIBLE: Classifiers from our own companion
|
||||
val n = C.Companion.FromCompanionC()
|
||||
|
||||
// INVISIBLE: direct superclasses themselves.
|
||||
val a = O.A()
|
||||
val b = O.B()
|
||||
|
||||
// DEPRECATED: Classifiers from companions of direct superclasses
|
||||
val e = O.A.Companion.FromCompanionA()
|
||||
val f = O.B.Companion.FromCompanionB()
|
||||
|
||||
// INVISIBLE: "cousin" supertypes themselves
|
||||
val g = O.Alpha()
|
||||
val h = O.Beta()
|
||||
val i = O.Gamma()
|
||||
|
||||
// DEPRECATED: classifiers from "cousin" superclasses
|
||||
val k = O.Alpha.FromAlpha()
|
||||
val l = O.Beta.FromBeta()
|
||||
val m = O.Gamma.FromGamma()
|
||||
|
||||
// INVISIBLE: We don't see classifiers from companions of "cousin" superclasses
|
||||
val o = O.Alpha.Companion.FromCompanionAlpha()
|
||||
val p = O.Beta.Companion.FromCompanionBeta()
|
||||
val q = O.Gamma.Companion.FromCompanionGamma()
|
||||
|
||||
// DEPRECATED: Classifiers from supertypes of our own companion
|
||||
val r = Delta.FromDelta()
|
||||
}
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
// !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
|
||||
// See KT-21515 for a class diagram and details
|
||||
|
||||
// Object is to prevent accidental short-name import
|
||||
object O {
|
||||
open class Alpha {
|
||||
class FromAlpha
|
||||
|
||||
companion object {
|
||||
class FromCompanionAlpha
|
||||
}
|
||||
}
|
||||
|
||||
open class Beta : Alpha() {
|
||||
class FromBeta
|
||||
|
||||
companion object {
|
||||
class FromCompanionBeta
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
open class A {
|
||||
class FromA
|
||||
|
||||
companion object : Beta() {
|
||||
class FromCompanionA
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////
|
||||
|
||||
open class FarAway {
|
||||
class FromFarAway
|
||||
|
||||
}
|
||||
|
||||
open class Gamma {
|
||||
class FromGamma
|
||||
companion object : FarAway() {
|
||||
class FromCompanionGamma
|
||||
}
|
||||
}
|
||||
|
||||
open class B : A() {
|
||||
class FromB
|
||||
|
||||
companion object : Gamma() {
|
||||
class FromCompanionB
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////
|
||||
|
||||
|
||||
open class Delta {
|
||||
class FromDelta
|
||||
}
|
||||
|
||||
class C : O.B() {
|
||||
companion object : Delta() {
|
||||
class FromCompanionC
|
||||
}
|
||||
|
||||
// VISIBLE: Classifiers from direct superclasses
|
||||
val c = O.A.FromA()
|
||||
val d = O.B.FromB()
|
||||
|
||||
// VISIBLE: Classifiers from our own companion
|
||||
val n = C.Companion.FromCompanionC()
|
||||
|
||||
// INVISIBLE: direct superclasses themselves.
|
||||
val a = O.A()
|
||||
val b = O.B()
|
||||
|
||||
// DEPRECATED: Classifiers from companions of direct superclasses
|
||||
val e = O.A.Companion.FromCompanionA()
|
||||
val f = O.B.Companion.FromCompanionB()
|
||||
|
||||
// INVISIBLE: "cousin" supertypes themselves
|
||||
val g = O.Alpha()
|
||||
val h = O.Beta()
|
||||
val i = O.Gamma()
|
||||
|
||||
// DEPRECATED: classifiers from "cousin" superclasses
|
||||
val k = O.Alpha.FromAlpha()
|
||||
val l = O.Beta.FromBeta()
|
||||
val m = O.Gamma.FromGamma()
|
||||
|
||||
// INVISIBLE: We don't see classifiers from companions of "cousin" superclasses
|
||||
val o = O.Alpha.Companion.FromCompanionAlpha()
|
||||
val p = O.Beta.Companion.FromCompanionBeta()
|
||||
val q = O.Gamma.Companion.FromCompanionGamma()
|
||||
|
||||
// DEPRECATED: Classifiers from supertypes of our own companion
|
||||
val r = Delta.FromDelta()
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package a
|
||||
|
||||
//KT-2240 Wrong overload resolution ambiguity when object literal is involved
|
||||
|
||||
class A {}
|
||||
|
||||
fun <T> A.foo(f : T) {}
|
||||
|
||||
val o = object {
|
||||
fun <T> foo(f: T) {
|
||||
A().foo(f) // Ambiguity here!
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
|
||||
object Boo {}
|
||||
class A {
|
||||
object Boo {}
|
||||
}
|
||||
|
||||
fun foo() {
|
||||
val i1: Int = Boo
|
||||
val i2: Int = A.Boo
|
||||
<!INAPPLICABLE_CANDIDATE!>useInt<!>(Boo)
|
||||
<!INAPPLICABLE_CANDIDATE!>useInt<!>(A.Boo)
|
||||
}
|
||||
fun bar() {
|
||||
val i1: Int = Unit
|
||||
<!INAPPLICABLE_CANDIDATE!>useInt<!>(Unit)
|
||||
}
|
||||
|
||||
fun useInt(i: Int) = i
|
||||
@@ -0,0 +1,11 @@
|
||||
// !CHECK_TYPE
|
||||
|
||||
fun foo() {
|
||||
val a = object {
|
||||
val b = object {
|
||||
val c = 42
|
||||
}
|
||||
}
|
||||
|
||||
checkSubtype<Int>(a.b.c)
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
|
||||
fun foo() {
|
||||
object a {}
|
||||
val b = object {
|
||||
object c {}
|
||||
}
|
||||
b.c
|
||||
class A {
|
||||
object d {}
|
||||
}
|
||||
val f = {
|
||||
object e {}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
class X {
|
||||
val foo = object {
|
||||
class Foo
|
||||
}
|
||||
|
||||
fun test() {
|
||||
object {
|
||||
class Foo
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
interface A {
|
||||
val foo: Int
|
||||
val bar: String
|
||||
get() = ""
|
||||
}
|
||||
|
||||
fun test(foo: Int, bar: Int) {
|
||||
object : A {
|
||||
override val foo: Int = foo + bar
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
interface A
|
||||
|
||||
interface B
|
||||
|
||||
fun test1(): B = object : A {
|
||||
}
|
||||
|
||||
fun test2(): B = object {
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
interface Trait<N : Number>
|
||||
|
||||
object O1 : Trait<Int>
|
||||
|
||||
object O2 : Trait<String>
|
||||
|
||||
class C {
|
||||
companion object : Trait<IntRange>
|
||||
}
|
||||
Reference in New Issue
Block a user