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:
+4
-2
@@ -60,7 +60,7 @@ class ClassResolutionScopesSupport(
|
||||
createInheritanceScope(inheritanceScopeWithoutMe(), classDescriptor, classDescriptor, withCompanionObject = false)
|
||||
}
|
||||
|
||||
val scopeForMemberDeclarationResolution: () -> LexicalScope = storageManager.createLazyValue {
|
||||
val scopeForMemberDeclarationResolution: () -> LexicalScope = storageManager.createLazyValue(onRecursion = createThrowingLexicalScope) {
|
||||
val scopeWithGenerics = scopeWithGenerics(inheritanceScopeWithMe())
|
||||
LexicalScopeImpl(scopeWithGenerics, classDescriptor, true, classDescriptor.thisAsReceiverParameter, LexicalScopeKind.CLASS_MEMBER_SCOPE)
|
||||
}
|
||||
@@ -116,7 +116,9 @@ class ClassResolutionScopesSupport(
|
||||
createLazyValueWithPostCompute(compute, onRecursion, {})
|
||||
|
||||
companion object {
|
||||
private val createThrowingLexicalScope: (Boolean) -> LexicalScope = { ThrowingLexicalScope() }
|
||||
private val createThrowingLexicalScope: (Boolean) -> LexicalScope = {
|
||||
ThrowingLexicalScope()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user