KT-13161 java static methods call not working for typealias
Introduce special qualifier for type aliases with member scope containing static class members only.
This commit is contained in:
+46
@@ -0,0 +1,46 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// FILE: JTest.java
|
||||
public class JTest {
|
||||
public static String foo() { return ""; }
|
||||
public static class Nested {}
|
||||
}
|
||||
|
||||
// FILE: JDerived.java
|
||||
public class JDerived extends JTest {
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
class KTest {
|
||||
class Nested
|
||||
inner class Inner
|
||||
}
|
||||
|
||||
interface ITest {
|
||||
class Nested
|
||||
}
|
||||
|
||||
typealias JT = JTest
|
||||
typealias JD = JDerived
|
||||
typealias KT = KTest
|
||||
typealias IT = ITest
|
||||
|
||||
// Referencing Java class static members via type alias should be ok
|
||||
val testFoo: String = JT.foo()
|
||||
val seeAlsoFoo: String = JTest.foo()
|
||||
// Referencing base Java class static members via type alias for derived Java class should be ok
|
||||
val testDerivedFoo: String = JD.foo()
|
||||
val seeAlsoDerivedFoo: String = JDerived.foo()
|
||||
|
||||
// Referencing nested classes via type alias should be prohibited
|
||||
// (in type position and in expression position)
|
||||
val testNested1: JT.<!UNRESOLVED_REFERENCE!>Nested<!> = JT.<!UNRESOLVED_REFERENCE!>Nested<!>()
|
||||
val testNested2: KT.<!UNRESOLVED_REFERENCE!>Nested<!> = KT.<!UNRESOLVED_REFERENCE!>Nested<!>()
|
||||
val testNested3: IT.<!UNRESOLVED_REFERENCE!>Nested<!> = IT.<!UNRESOLVED_REFERENCE!>Nested<!>()
|
||||
val testInner1: JT.<!UNRESOLVED_REFERENCE!>Inner<!> = JT.<!UNRESOLVED_REFERENCE!>Inner<!>()
|
||||
val testInner2: KT.<!UNRESOLVED_REFERENCE!>Inner<!> = KT.<!UNRESOLVED_REFERENCE!>Inner<!>()
|
||||
fun testNestedAsTypeArgument1(x: List<JT.<!UNRESOLVED_REFERENCE!>Nested<!>>) {}
|
||||
fun testNestedAsTypeArgument2(x: List<KT.<!UNRESOLVED_REFERENCE!>Nested<!>>) {}
|
||||
fun testNestedAsTypeArgument3(x: List<IT.<!UNRESOLVED_REFERENCE!>Nested<!>>) {}
|
||||
fun testInnerAsTypeArgument1(x: List<JT.<!UNRESOLVED_REFERENCE!>Inner<!>>) {}
|
||||
fun testInnerAsTypeArgument2(x: List<KT.<!UNRESOLVED_REFERENCE!>Inner<!>>) {}
|
||||
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
package
|
||||
|
||||
public typealias IT = ITest
|
||||
public typealias JD = JDerived
|
||||
public typealias JT = JTest
|
||||
public typealias KT = KTest
|
||||
public val seeAlsoDerivedFoo: kotlin.String
|
||||
public val seeAlsoFoo: kotlin.String
|
||||
public val testDerivedFoo: kotlin.String
|
||||
public val testFoo: kotlin.String
|
||||
public val testInner1: [ERROR : JT.Inner]
|
||||
public val testInner2: [ERROR : KT.Inner]
|
||||
public val testNested1: [ERROR : JT.Nested]
|
||||
public val testNested2: [ERROR : KT.Nested]
|
||||
public val testNested3: [ERROR : IT.Nested]
|
||||
public fun testInnerAsTypeArgument1(/*0*/ x: kotlin.collections.List<[ERROR : JT.Inner]>): kotlin.Unit
|
||||
public fun testInnerAsTypeArgument2(/*0*/ x: kotlin.collections.List<[ERROR : KT.Inner]>): kotlin.Unit
|
||||
public fun testNestedAsTypeArgument1(/*0*/ x: kotlin.collections.List<[ERROR : JT.Nested]>): kotlin.Unit
|
||||
public fun testNestedAsTypeArgument2(/*0*/ x: kotlin.collections.List<[ERROR : KT.Nested]>): kotlin.Unit
|
||||
public fun testNestedAsTypeArgument3(/*0*/ x: kotlin.collections.List<[ERROR : IT.Nested]>): kotlin.Unit
|
||||
|
||||
public interface ITest {
|
||||
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
|
||||
|
||||
public final class Nested {
|
||||
public constructor Nested()
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
public open class JDerived : JTest {
|
||||
public constructor JDerived()
|
||||
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
|
||||
|
||||
// Static members
|
||||
public open override /*1*/ /*fake_override*/ fun foo(): kotlin.String!
|
||||
}
|
||||
|
||||
public open class JTest {
|
||||
public constructor JTest()
|
||||
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
|
||||
|
||||
public open class Nested {
|
||||
public constructor Nested()
|
||||
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
|
||||
}
|
||||
|
||||
// Static members
|
||||
public open fun foo(): kotlin.String!
|
||||
}
|
||||
|
||||
public final class KTest {
|
||||
public constructor KTest()
|
||||
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
|
||||
|
||||
public final inner class Inner {
|
||||
public constructor Inner()
|
||||
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
|
||||
}
|
||||
|
||||
public final class Nested {
|
||||
public constructor Nested()
|
||||
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