Change resolution scope for componentX in lambda parameters

Component-functions are resolved in the same scope as the first statement of the lambda, but lambda receiver was not available

 #KT-14692 Fixed
This commit is contained in:
Denis Zharkov
2016-11-09 18:10:17 +03:00
parent 6656bf835f
commit 24819a079b
5 changed files with 53 additions and 20 deletions
@@ -201,6 +201,11 @@ fun LexicalScope.replaceImportingScopes(importingScopeChain: ImportingScope?): L
return LexicalScopeWrapper(this, newImportingScopeChain)
}
fun LexicalScope.addImplicitReceiver(newReceiver: ReceiverParameterDescriptor?): LexicalScope {
if (newReceiver == null) return this
return LexicalScopeImpl(parent, ownerDescriptor, isOwnerDescriptorAccessibleByLabel, newReceiver, kind)
}
private class LexicalScopeWrapper(val delegate: LexicalScope, val newImportingScopeChain: ImportingScope): LexicalScope by delegate {
init {
assert(delegate !is LexicalScopeWrapper) {