Perform resolve of constructor parameters during partial constructor resove
#KT-13354 Fixed
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2015 JetBrains s.r.o.
|
* Copyright 2010-2016 JetBrains s.r.o.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -77,9 +77,6 @@ class PseudocodeVariableDataCollector(
|
|||||||
if (instruction is VariableDeclarationInstruction) {
|
if (instruction is VariableDeclarationInstruction) {
|
||||||
val variableDeclarationElement = instruction.variableDeclarationElement
|
val variableDeclarationElement = instruction.variableDeclarationElement
|
||||||
val descriptor = bindingContext.get(BindingContext.DECLARATION_TO_DESCRIPTOR, variableDeclarationElement) ?: return@traverse
|
val descriptor = bindingContext.get(BindingContext.DECLARATION_TO_DESCRIPTOR, variableDeclarationElement) ?: return@traverse
|
||||||
// TODO: investigate why tests fail without this eager computation here
|
|
||||||
// TODO: https://youtrack.jetbrains.com/issue/KT-13354
|
|
||||||
descriptor.toString()
|
|
||||||
val variableDescriptor = BindingContextUtils.variableDescriptorForDeclaration(descriptor)
|
val variableDescriptor = BindingContextUtils.variableDescriptorForDeclaration(descriptor)
|
||||||
?: throw AssertionError("Variable or class descriptor should correspond to " +
|
?: throw AssertionError("Variable or class descriptor should correspond to " +
|
||||||
"the instruction for ${instruction.element.text}.\n" +
|
"the instruction for ${instruction.element.text}.\n" +
|
||||||
|
|||||||
@@ -530,6 +530,7 @@ class ResolveElementCache(
|
|||||||
val constructorDescriptor = classDescriptor.unsubstitutedPrimaryConstructor
|
val constructorDescriptor = classDescriptor.unsubstitutedPrimaryConstructor
|
||||||
?: error("Can't get primary constructor for descriptor '$classDescriptor' " +
|
?: error("Can't get primary constructor for descriptor '$classDescriptor' " +
|
||||||
"in from class '${klass.getElementTextWithContext()}'")
|
"in from class '${klass.getElementTextWithContext()}'")
|
||||||
|
ForceResolveUtil.forceResolveAllContents(constructorDescriptor)
|
||||||
|
|
||||||
val primaryConstructor = klass.getPrimaryConstructor()
|
val primaryConstructor = klass.getPrimaryConstructor()
|
||||||
if (primaryConstructor != null) {
|
if (primaryConstructor != null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user