Lazy resolve: fix scope for primary constructor parameters
For classes on top level scope was getting for file, which may introduce resolution problems with generics #KT-8829 Fixed
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2016 JetBrains s.r.o.
|
||||
* Copyright 2010-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -524,7 +524,6 @@ class ResolveElementCache(
|
||||
|
||||
private fun constructorAdditionalResolve(resolveSession: ResolveSession, klass: KtClassOrObject, file: KtFile, filter : BindingTraceFilter): BindingTrace {
|
||||
val trace = createDelegatingTrace(klass, filter)
|
||||
val scope = resolveSession.declarationScopeProvider.getResolutionScopeForDeclaration(klass)
|
||||
|
||||
val classDescriptor = resolveSession.resolveToDescriptor(klass) as ClassDescriptor
|
||||
val constructorDescriptor = classDescriptor.unsubstitutedPrimaryConstructor
|
||||
@@ -534,6 +533,7 @@ class ResolveElementCache(
|
||||
|
||||
val primaryConstructor = klass.primaryConstructor
|
||||
if (primaryConstructor != null) {
|
||||
val scope = resolveSession.declarationScopeProvider.getResolutionScopeForDeclaration(primaryConstructor)
|
||||
val bodyResolver = createBodyResolver(resolveSession, trace, file, StatementFilter.NONE)
|
||||
bodyResolver.resolveConstructorParameterDefaultValues(DataFlowInfo.EMPTY, trace, primaryConstructor, constructorDescriptor, scope)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user