Change outer scope for nested class and object -- removed implicit outer class receiver.
#KT-5362 Fixed #KT-8814 Fixed
This commit is contained in:
+5
@@ -63,6 +63,11 @@ public class DeclarationScopeProviderImpl implements DeclarationScopeProvider {
|
||||
if (jetDeclaration instanceof JetClassInitializer || jetDeclaration instanceof JetProperty) {
|
||||
return classDescriptor.getScopeForInitializerResolution();
|
||||
}
|
||||
if (jetDeclaration instanceof JetObjectDeclaration
|
||||
|| (jetDeclaration instanceof JetClass && !((JetClass) jetDeclaration).isInner())) {
|
||||
return classDescriptor.getScopeForStaticMemberDeclarationResolution();
|
||||
}
|
||||
|
||||
return classDescriptor.getScopeForMemberDeclarationResolution();
|
||||
}
|
||||
|
||||
|
||||
+16
@@ -27,11 +27,15 @@ class ClassResolutionScopesSupport(
|
||||
) {
|
||||
private val scopeForClassHeaderResolution = storageManager.createLazyValue { computeScopeForClassHeaderResolution() }
|
||||
private val scopeForMemberDeclarationResolution = storageManager.createLazyValue { computeScopeForMemberDeclarationResolution() }
|
||||
private val scopeForStaticMemberDeclarationResolution = storageManager.createLazyValue { computeScopeForStaticMemberDeclarationResolution() }
|
||||
|
||||
|
||||
fun getScopeForClassHeaderResolution(): JetScope = scopeForClassHeaderResolution()
|
||||
|
||||
fun getScopeForMemberDeclarationResolution(): JetScope = scopeForMemberDeclarationResolution()
|
||||
|
||||
fun getScopeForStaticMemberDeclarationResolution(): JetScope = scopeForStaticMemberDeclarationResolution()
|
||||
|
||||
private fun computeScopeForClassHeaderResolution(): JetScope {
|
||||
val scope = WritableScopeImpl(JetScope.Empty, classDescriptor, RedeclarationHandler.DO_NOTHING, "Scope with type parameters for " + classDescriptor.getName())
|
||||
for (typeParameterDescriptor in classDescriptor.getTypeConstructor().getParameters()) {
|
||||
@@ -62,6 +66,18 @@ class ClassResolutionScopesSupport(
|
||||
return thisScope
|
||||
}
|
||||
|
||||
private fun computeScopeForStaticMemberDeclarationResolution(): JetScope {
|
||||
if (classDescriptor.getKind().isSingleton) return scopeForMemberDeclarationResolution()
|
||||
|
||||
return ChainedScope(
|
||||
classDescriptor,
|
||||
"ScopeForStaticMemberDeclarationResolution: " + classDescriptor.getName(),
|
||||
classDescriptor.unsubstitutedInnerClassesScope,
|
||||
getOuterScope(),
|
||||
getCompanionObjectScope(),
|
||||
classDescriptor.getStaticScope())
|
||||
}
|
||||
|
||||
private fun getCompanionObjectScope(): JetScope {
|
||||
val companionObjectDescriptor = classDescriptor.getCompanionObjectDescriptor()
|
||||
return if (companionObjectDescriptor != null) {
|
||||
|
||||
+4
@@ -270,6 +270,10 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes
|
||||
return resolutionScopesSupport.getScopeForMemberDeclarationResolution();
|
||||
}
|
||||
|
||||
public JetScope getScopeForStaticMemberDeclarationResolution() {
|
||||
return resolutionScopesSupport.getScopeForStaticMemberDeclarationResolution();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public JetScope getScopeForInitializerResolution() {
|
||||
|
||||
Vendored
+2
-2
@@ -15,7 +15,7 @@ class A {
|
||||
|
||||
companion object {
|
||||
fun main() {
|
||||
::<!INACCESSIBLE_OUTER_CLASS_EXPRESSION!>Inner<!>
|
||||
::<!UNRESOLVED_REFERENCE!>Inner<!>
|
||||
val y = A::Inner
|
||||
|
||||
checkSubtype<KFunction1<A, A.Inner>>(y)
|
||||
@@ -30,4 +30,4 @@ class B {
|
||||
|
||||
checkSubtype<KFunction1<A, A.Inner>>(y)
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -4,6 +4,6 @@ class A() {
|
||||
val x = 1
|
||||
|
||||
companion object {
|
||||
val y = <!INACCESSIBLE_OUTER_CLASS_EXPRESSION!>x<!>
|
||||
val y = <!UNRESOLVED_REFERENCE!>x<!>
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -9,7 +9,7 @@ internal final class A {
|
||||
|
||||
public companion object Companion {
|
||||
private constructor Companion()
|
||||
internal final val y: kotlin.Int = 1
|
||||
internal final val y: [ERROR : Type for x]
|
||||
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
|
||||
|
||||
@@ -4,6 +4,6 @@ open class ToResolve<SomeClass>(<!UNUSED_PARAMETER!>f<!> : (Int) -> Int)
|
||||
fun testFun(<!UNUSED_PARAMETER!>a<!> : Int) = 12
|
||||
|
||||
class TestSome<P> {
|
||||
companion object : ToResolve<<!INACCESSIBLE_OUTER_CLASS_EXPRESSION!>P<!>>({testFun(it)}) {
|
||||
companion object : ToResolve<<!UNRESOLVED_REFERENCE!>P<!>>({testFun(it)}) {
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ package test {
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
public companion object Companion : test.ToResolve<P> {
|
||||
public companion object Companion : test.ToResolve<[ERROR : P]> {
|
||||
private constructor Companion()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
|
||||
+1
-1
@@ -4,6 +4,6 @@ class Test {
|
||||
fun test(): Int = 12
|
||||
|
||||
companion object {
|
||||
val a = <!INACCESSIBLE_OUTER_CLASS_EXPRESSION!>test()<!> // Check if resolver will be able to infer type of a variable
|
||||
val a = <!UNRESOLVED_REFERENCE!>test<!>() // Check if resolver will be able to infer type of a variable
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -11,7 +11,7 @@ package test {
|
||||
|
||||
public companion object Companion {
|
||||
private constructor Companion()
|
||||
internal final val a: kotlin.Int
|
||||
internal final val a: [ERROR : Type for test()]
|
||||
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,6 +1,6 @@
|
||||
class Test {
|
||||
@`InnerAnnotation` <!REPEATED_ANNOTATION!>@InnerAnnotation<!>
|
||||
companion object : StaticClass(), <!INACCESSIBLE_OUTER_CLASS_EXPRESSION!><!MANY_CLASSES_IN_SUPERTYPE_LIST!>InnerClass<!>()<!> {
|
||||
companion object : StaticClass(), <!UNRESOLVED_REFERENCE, MANY_CLASSES_IN_SUPERTYPE_LIST, DEBUG_INFO_UNRESOLVED_WITH_TARGET!>InnerClass<!>() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@ class Outer1 {
|
||||
|
||||
inner class Inner
|
||||
|
||||
class C5 { val b = <!INACCESSIBLE_OUTER_CLASS_EXPRESSION!>Inner()<!> }
|
||||
class C6(val b: Any = <!INACCESSIBLE_OUTER_CLASS_EXPRESSION!>Inner()<!>)
|
||||
class C5 { val b = <!NO_COMPANION_OBJECT, FUNCTION_EXPECTED!>Inner<!>() }
|
||||
class C6(val b: Any = <!NO_COMPANION_OBJECT, FUNCTION_EXPECTED!>Inner<!>())
|
||||
inner class C7 { val b = Inner() }
|
||||
inner class C8(val b: Any = Inner())
|
||||
}
|
||||
@@ -18,7 +18,7 @@ class Outer1 {
|
||||
class Outer2 {
|
||||
class Nested {
|
||||
fun foo() = Outer2()
|
||||
fun bar() = <!INACCESSIBLE_OUTER_CLASS_EXPRESSION!>Inner()<!>
|
||||
fun bar() = <!NO_COMPANION_OBJECT, FUNCTION_EXPECTED!>Inner<!>()
|
||||
}
|
||||
inner class Inner {
|
||||
fun foo() = Outer2()
|
||||
@@ -29,4 +29,4 @@ class Outer2 {
|
||||
Nested()
|
||||
Inner()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -40,7 +40,7 @@ internal final class Outer1 {
|
||||
|
||||
internal final class C5 {
|
||||
public constructor C5()
|
||||
internal final val b: Outer1.Inner
|
||||
internal final val b: [ERROR : Type for 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
|
||||
@@ -103,7 +103,7 @@ internal final class Outer2 {
|
||||
|
||||
internal final class Nested {
|
||||
public constructor Nested()
|
||||
internal final fun bar(): Outer2.Inner
|
||||
internal final fun bar(): [ERROR : Error function type]
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
internal final fun foo(): Outer2
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
|
||||
@@ -3,11 +3,11 @@ interface P<U, Y>
|
||||
class A<T> {
|
||||
class B {
|
||||
fun test() {
|
||||
class C<W>() : P<W, <!INACCESSIBLE_OUTER_CLASS_EXPRESSION!>T<!>> {
|
||||
<!WRONG_MODIFIER_CONTAINING_DECLARATION!>companion<!> object : P<<!INACCESSIBLE_OUTER_CLASS_EXPRESSION!>W<!>, <!INACCESSIBLE_OUTER_CLASS_EXPRESSION!>T<!>> {
|
||||
class C<W>() : P<W, <!UNRESOLVED_REFERENCE!>T<!>> {
|
||||
<!WRONG_MODIFIER_CONTAINING_DECLARATION!>companion<!> object : P<<!UNRESOLVED_REFERENCE!>W<!>, <!UNRESOLVED_REFERENCE!>T<!>> {
|
||||
}
|
||||
|
||||
inner class D : P<W, <!INACCESSIBLE_OUTER_CLASS_EXPRESSION!>T<!>>
|
||||
inner class D : P<W, <!UNRESOLVED_REFERENCE!>T<!>>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
open class SomeClass<T>
|
||||
class TestSome<P> {
|
||||
companion object : SomeClass<<!INACCESSIBLE_OUTER_CLASS_EXPRESSION!>P<!>>() {
|
||||
companion object : SomeClass<<!UNRESOLVED_REFERENCE!>P<!>>() {
|
||||
}
|
||||
}
|
||||
|
||||
class Test {
|
||||
companion object : <!INACCESSIBLE_OUTER_CLASS_EXPRESSION!>InnerClass()<!> {
|
||||
val a = object: <!INACCESSIBLE_OUTER_CLASS_EXPRESSION!>InnerClass()<!> {
|
||||
companion object : <!UNRESOLVED_REFERENCE, DEBUG_INFO_UNRESOLVED_WITH_TARGET!>InnerClass<!>() {
|
||||
val a = object: <!UNRESOLVED_REFERENCE, DEBUG_INFO_UNRESOLVED_WITH_TARGET!>InnerClass<!>() {
|
||||
}
|
||||
|
||||
fun more(): InnerClass {
|
||||
val b = <!INACCESSIBLE_OUTER_CLASS_EXPRESSION!>InnerClass()<!>
|
||||
val b = <!NO_COMPANION_OBJECT, FUNCTION_EXPECTED!>InnerClass<!>()
|
||||
|
||||
val <!UNUSED_VARIABLE!>testVal<!> = <!INACCESSIBLE_OUTER_CLASS_EXPRESSION!>inClass<!>
|
||||
<!INACCESSIBLE_OUTER_CLASS_EXPRESSION!>foo()<!>
|
||||
val <!UNUSED_VARIABLE!>testVal<!> = <!UNRESOLVED_REFERENCE!>inClass<!>
|
||||
<!UNRESOLVED_REFERENCE!>foo<!>()
|
||||
|
||||
return b
|
||||
return <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>b<!>
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ internal final class TestSome</*0*/ P> {
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
public companion object Companion : SomeClass<P> {
|
||||
public companion object Companion : SomeClass<[ERROR : P]> {
|
||||
private constructor Companion()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
open class SomeClass<T>
|
||||
class TestSome<P> {
|
||||
object Some : SomeClass<<!INACCESSIBLE_OUTER_CLASS_EXPRESSION!>P<!>>() {
|
||||
object Some : SomeClass<<!UNRESOLVED_REFERENCE!>P<!>>() {
|
||||
}
|
||||
}
|
||||
|
||||
class Test {
|
||||
object Some : <!INACCESSIBLE_OUTER_CLASS_EXPRESSION!>InnerClass()<!> {
|
||||
val a = object: <!INACCESSIBLE_OUTER_CLASS_EXPRESSION!>InnerClass()<!> {
|
||||
object Some : <!UNRESOLVED_REFERENCE, DEBUG_INFO_UNRESOLVED_WITH_TARGET!>InnerClass<!>() {
|
||||
val a = object: <!UNRESOLVED_REFERENCE, DEBUG_INFO_UNRESOLVED_WITH_TARGET!>InnerClass<!>() {
|
||||
}
|
||||
|
||||
fun more(): InnerClass {
|
||||
val b = <!INACCESSIBLE_OUTER_CLASS_EXPRESSION!>InnerClass()<!>
|
||||
val b = <!NO_COMPANION_OBJECT, FUNCTION_EXPECTED!>InnerClass<!>()
|
||||
|
||||
val <!UNUSED_VARIABLE!>testVal<!> = <!INACCESSIBLE_OUTER_CLASS_EXPRESSION!>inClass<!>
|
||||
<!INACCESSIBLE_OUTER_CLASS_EXPRESSION!>foo()<!>
|
||||
val <!UNUSED_VARIABLE!>testVal<!> = <!UNRESOLVED_REFERENCE!>inClass<!>
|
||||
<!UNRESOLVED_REFERENCE!>foo<!>()
|
||||
|
||||
return b
|
||||
return <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>b<!>
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ internal final class TestSome</*0*/ P> {
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
internal object Some : SomeClass<P> {
|
||||
internal object Some : SomeClass<[ERROR : P]> {
|
||||
private constructor Some()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
|
||||
@@ -4,12 +4,12 @@ interface Trait {
|
||||
|
||||
class Outer : Trait {
|
||||
class Nested {
|
||||
val t = this<!INACCESSIBLE_OUTER_CLASS_EXPRESSION!>@Outer<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>bar<!>()
|
||||
val s = super<!INACCESSIBLE_OUTER_CLASS_EXPRESSION!>@Outer<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>bar<!>()
|
||||
val t = this<!UNRESOLVED_REFERENCE!>@Outer<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>bar<!>()
|
||||
val s = <!DEBUG_INFO_MISSING_UNRESOLVED!>super<!><!UNRESOLVED_REFERENCE!>@Outer<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>bar<!>()
|
||||
|
||||
inner class NestedInner {
|
||||
val t = this<!INACCESSIBLE_OUTER_CLASS_EXPRESSION!>@Outer<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>bar<!>()
|
||||
val s = super<!INACCESSIBLE_OUTER_CLASS_EXPRESSION!>@Outer<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>bar<!>()
|
||||
val t = this<!UNRESOLVED_REFERENCE!>@Outer<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>bar<!>()
|
||||
val s = <!DEBUG_INFO_MISSING_UNRESOLVED!>super<!><!UNRESOLVED_REFERENCE!>@Outer<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>bar<!>()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,4 +17,4 @@ class Outer : Trait {
|
||||
val t = this@Outer.bar()
|
||||
val s = super@Outer.bar()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,10 @@ class Outer {
|
||||
class Nested {
|
||||
fun foo() {
|
||||
class Local {
|
||||
val state = <!INACCESSIBLE_OUTER_CLASS_EXPRESSION!>outerState<!>
|
||||
val state = <!UNRESOLVED_REFERENCE!>outerState<!>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val outerState = 42
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -7,11 +7,11 @@ class Outer {
|
||||
|
||||
class Nested1 : OpenNested()
|
||||
class Nested2 : <!FINAL_SUPERTYPE!>FinalNested<!>()
|
||||
class Nested3 : <!INACCESSIBLE_OUTER_CLASS_EXPRESSION!>OpenInner()<!>
|
||||
class Nested3 : <!UNRESOLVED_REFERENCE, DEBUG_INFO_UNRESOLVED_WITH_TARGET!>OpenInner<!>()
|
||||
class Nested4 : <!FINAL_SUPERTYPE!>FinalInner<!>()
|
||||
|
||||
inner class Inner1 : OpenNested()
|
||||
inner class Inner2 : <!FINAL_SUPERTYPE!>FinalNested<!>()
|
||||
inner class Inner3 : OpenInner()
|
||||
inner class Inner4 : <!FINAL_SUPERTYPE!>FinalInner<!>()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
object Object {
|
||||
class NestedClass {
|
||||
fun test() {
|
||||
outerFun()
|
||||
outerVal
|
||||
OuterObject
|
||||
OuterClass()
|
||||
}
|
||||
}
|
||||
|
||||
fun outerFun() {}
|
||||
val outerVal = 4
|
||||
|
||||
object OuterObject
|
||||
class OuterClass
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package
|
||||
|
||||
internal object Object {
|
||||
private constructor Object()
|
||||
internal final val outerVal: kotlin.Int = 4
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
internal final fun outerFun(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
internal final class NestedClass {
|
||||
public constructor NestedClass()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
internal final fun test(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
internal final class OuterClass {
|
||||
public constructor OuterClass()
|
||||
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
|
||||
}
|
||||
|
||||
internal object OuterObject {
|
||||
private constructor OuterObject()
|
||||
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
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -3,10 +3,10 @@ class Outer {
|
||||
val property = ""
|
||||
|
||||
class Nested {
|
||||
fun f() = <!INACCESSIBLE_OUTER_CLASS_EXPRESSION!>function()<!>
|
||||
fun g() = <!INACCESSIBLE_OUTER_CLASS_EXPRESSION!>property<!>
|
||||
fun h() = this<!INACCESSIBLE_OUTER_CLASS_EXPRESSION!>@Outer<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>function<!>()
|
||||
fun i() = this<!INACCESSIBLE_OUTER_CLASS_EXPRESSION!>@Outer<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>property<!>
|
||||
fun f() = <!UNRESOLVED_REFERENCE!>function<!>()
|
||||
fun g() = <!UNRESOLVED_REFERENCE!>property<!>
|
||||
fun h() = this<!UNRESOLVED_REFERENCE!>@Outer<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>function<!>()
|
||||
fun i() = this<!UNRESOLVED_REFERENCE!>@Outer<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>property<!>
|
||||
}
|
||||
|
||||
inner class Inner {
|
||||
|
||||
+2
-2
@@ -33,8 +33,8 @@ internal final class Outer {
|
||||
internal final class Nested {
|
||||
public constructor Nested()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
internal final fun f(): kotlin.Int
|
||||
internal final fun g(): kotlin.String
|
||||
internal final fun f(): [ERROR : Error function type]
|
||||
internal final fun g(): [ERROR : Error function type]
|
||||
internal final fun h(): [ERROR : <ERROR FUNCTION RETURN TYPE>]
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
internal final fun i(): [ERROR : <ERROR PROPERTY TYPE>]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class Outer<T> {
|
||||
class Nested {
|
||||
fun foo(t: <!INACCESSIBLE_OUTER_CLASS_EXPRESSION!>T<!>) = t
|
||||
fun foo(t: <!UNRESOLVED_REFERENCE!>T<!>) = <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>t<!>
|
||||
}
|
||||
|
||||
class Nested2<T> {
|
||||
@@ -10,4 +10,4 @@ class Outer<T> {
|
||||
inner class Inner {
|
||||
fun foo(t: T) = t
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@ internal final class Outer</*0*/ T> {
|
||||
internal final class Nested {
|
||||
public constructor Nested()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
internal final fun foo(/*0*/ t: T): T
|
||||
internal final fun foo(/*0*/ t: [ERROR : T]): [ERROR : T]
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@@ -4,6 +4,6 @@ open class Base {
|
||||
|
||||
class Derived : Base() {
|
||||
class Nested {
|
||||
fun bar() = <!INACCESSIBLE_OUTER_CLASS_EXPRESSION!>foo()<!>
|
||||
fun bar() = <!UNRESOLVED_REFERENCE!>foo<!>()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@ internal final class Derived : Base {
|
||||
|
||||
internal final class Nested {
|
||||
public constructor Nested()
|
||||
internal final fun bar(): kotlin.Unit
|
||||
internal final fun bar(): [ERROR : Error function type]
|
||||
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
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
// KT-5362 Compiler crashes on access to extension method from nested class
|
||||
class Outer {
|
||||
class Nested{
|
||||
fun foo(s: String) = s.<!UNRESOLVED_REFERENCE!>extension<!>()
|
||||
}
|
||||
|
||||
private fun String.extension(): String = this
|
||||
}
|
||||
|
||||
// EA-64302 - UOE: CodegenContext.getOuterExpression
|
||||
fun Activity.toast() = Unit
|
||||
class Activity(){
|
||||
class Fragment{
|
||||
fun call() = <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>toast<!>()
|
||||
}
|
||||
}
|
||||
|
||||
// KT-8814 No error in IDE for invalid invoke of OuterClass.()->Unit in static nested class
|
||||
public class Manager {
|
||||
fun task(callback: Manager.() -> Unit): Task {
|
||||
val task = Task(callback)
|
||||
return task
|
||||
}
|
||||
|
||||
class Task(val callback: Manager.() -> Unit) : Runnable {
|
||||
override public fun run() {
|
||||
<!MISSING_RECEIVER!>callback<!>() // Manager is not accessible here, but no error is shown
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package
|
||||
|
||||
internal fun Activity.toast(): kotlin.Unit
|
||||
|
||||
internal final class Activity {
|
||||
public constructor Activity()
|
||||
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
|
||||
|
||||
internal final class Fragment {
|
||||
public constructor Fragment()
|
||||
internal final fun call(): [ERROR : Error function type]
|
||||
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 Manager {
|
||||
public constructor Manager()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
internal final fun task(/*0*/ callback: Manager.() -> kotlin.Unit): Manager.Task
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
internal final class Task : java.lang.Runnable {
|
||||
public constructor Task(/*0*/ callback: Manager.() -> kotlin.Unit)
|
||||
internal final val callback: Manager.() -> kotlin.Unit
|
||||
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*/ fun run(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
|
||||
internal final class Outer {
|
||||
public constructor Outer()
|
||||
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
|
||||
private final fun kotlin.String.extension(): kotlin.String
|
||||
|
||||
internal final class Nested {
|
||||
public constructor Nested()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
internal final fun foo(/*0*/ s: kotlin.String): [ERROR : Error function type]
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
package qualified_this {
|
||||
~qtA~class A(val a:Int) {
|
||||
|
||||
~qtB~class B() {
|
||||
inner ~qtB~class B() {
|
||||
val x = `qtB`this`qtB`@B
|
||||
val y = `qtA`this`qtA`@A
|
||||
val z = `qtB`this
|
||||
@@ -20,7 +20,7 @@ class A<~T~T, ~E~E> {
|
||||
val a : `T`T
|
||||
val x : A<`T`T, `E`E>
|
||||
|
||||
class X<~X.T~T> : A<`X.T`T, `E`E> {
|
||||
inner class X<~X.T~T> : A<`X.T`T, `E`E> {
|
||||
val a : `X.T`T
|
||||
val b : `X.E`E
|
||||
|
||||
|
||||
@@ -8154,6 +8154,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("nestedClassInObject.kt")
|
||||
public void testNestedClassInObject() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/inner/nestedClassInObject.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("nestedClassNotAllowed.kt")
|
||||
public void testNestedClassNotAllowed() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/inner/nestedClassNotAllowed.kt");
|
||||
@@ -11328,6 +11334,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt5362.kt")
|
||||
public void testKt5362() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/regressions/kt5362.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt549.kt")
|
||||
public void testKt549() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/regressions/kt549.kt");
|
||||
|
||||
@@ -101,12 +101,6 @@ public class DiagnosticMessageTestGenerated extends AbstractDiagnosticMessageTes
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("inaccessibleOuterClassExpression.kt")
|
||||
public void testInaccessibleOuterClassExpression() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/diagnosticMessage/inaccessibleOuterClassExpression.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("invisibleMember.kt")
|
||||
public void testInvisibleMember() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/diagnosticMessage/invisibleMember.kt");
|
||||
|
||||
@@ -3976,12 +3976,6 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("addInnerModifier.kt")
|
||||
public void testAddInnerModifier() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/modifiers/addInnerModifier.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInModifiers() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/quickfix/modifiers"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user