Don't throw on recursion when computing member scope

When recursion is detected while computing
`ClassResolutionScopesSupport.scopeForMemberDeclarationResolution`,
create 'ThrowingLexicalScope' (as with other scopes), instead of
throwing ISE immediately. That allows to report error properly in cases
like in KT-18514

#KT-18514 Fixed
This commit is contained in:
Dmitry Savvinov
2017-10-31 18:07:45 +03:00
parent d6143e2af6
commit e17610f378
5 changed files with 86 additions and 2 deletions
@@ -0,0 +1,22 @@
// As in KT-18514
object A : <!CYCLIC_INHERITANCE_HIERARCHY!>A.I<!> {
interface I
}
// Similar to 'classIndirectlyInheritsNested.kt'
object D : <!CYCLIC_INHERITANCE_HIERARCHY!>E<!>() {
open class NestedD
}
open class E : <!CYCLIC_INHERITANCE_HIERARCHY!>D.NestedD<!>()
// Similar to 'twoClassesWithNestedCycle.kt'
object G : <!CYCLIC_INHERITANCE_HIERARCHY!>H.NestedH<!>() {
open class NestedG
}
object H : <!CYCLIC_INHERITANCE_HIERARCHY!>G.NestedG<!>() {
open class NestedH
}
@@ -0,0 +1,48 @@
package
public object A {
private constructor A()
public interface I {
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 object D {
private constructor D()
public open class NestedD {
public constructor NestedD()
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 E {
public constructor E()
}
public object G {
private constructor G()
public open class NestedG {
public constructor NestedG()
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 object H {
private constructor H()
public open class NestedH {
public constructor NestedH()
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
}
}