Fix TypeAliasConstructorDescriptor's to create only once when required

Some IDE features relates onto that same descriptors will remain same
between resolve calls
Fix it to be true for TypeAliasConstructorDescriptor's

 #KT-16265 fixed
This commit is contained in:
Simon Ogorodnik
2017-03-14 15:51:20 +03:00
parent 23cbb83c75
commit f56af41d1e
12 changed files with 113 additions and 46 deletions
@@ -19,7 +19,7 @@ package org.jetbrains.kotlin.util
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.resolve.OverridingUtil
import org.jetbrains.kotlin.resolve.OverridingUtil.OverrideCompatibilityInfo.Result.OVERRIDABLE
import org.jetbrains.kotlin.resolve.calls.tower.getTypeAliasConstructors
import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.TypeConstructor
@@ -81,7 +81,7 @@ fun TypeConstructor.supertypesWithAny(): Collection<KotlinType> {
val ClassifierDescriptorWithTypeParameters.constructors: Collection<ConstructorDescriptor>
get() = when (this) {
is TypeAliasDescriptor -> getTypeAliasConstructors()
is TypeAliasDescriptor -> this.constructors
is ClassDescriptor -> this.constructors
else -> emptyList()
}
@@ -0,0 +1,14 @@
class A(val a: Int) {
constructor(val b: String) : this(b.toInt())
}
typealias TA = A
fun usage() {
val x = TA(<caret>)
}
/*
Text: (<highlight>a: Int</highlight>), Disabled: false, Strikeout: false, Green: false
Text: (<highlight>b: String</highlight>), Disabled: false, Strikeout: false, Green: false
*/
@@ -323,6 +323,12 @@ public class ParameterInfoTestGenerated extends AbstractParameterInfoTest {
doTest(fileName);
}
@TestMetadata("TypeAliasConstructor.kt")
public void testTypeAliasConstructor() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/parameterInfo/functionCall/TypeAliasConstructor.kt");
doTest(fileName);
}
@TestMetadata("UpdateOnTyping.kt")
public void testUpdateOnTyping() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/parameterInfo/functionCall/UpdateOnTyping.kt");