Override/Implement Members: Do not expand type aliases in the generated members. Retain abbreviated types during flexible type approximation

#KT-13244 Fixed
This commit is contained in:
Alexey Sedunov
2016-08-08 16:25:22 +03:00
parent 1a4ff598e3
commit 1b546d18ff
9 changed files with 34 additions and 0 deletions
@@ -64,6 +64,10 @@ private fun KotlinType.approximateNonDynamicFlexibleTypes(preferNotNull: Boolean
return approximation
}
(unwrap() as? AbbreviatedType)?.let {
return AbbreviatedType(it.expandedType, it.abbreviation.approximateNonDynamicFlexibleTypes(preferNotNull))
}
return KotlinTypeFactory.simpleType(annotations,
constructor,
arguments.map { it.substitute { type -> type.approximateFlexibleTypes(preferNotNull = true) } },
@@ -132,6 +132,7 @@ private val OVERRIDE_RENDERER = DescriptorRenderer.withOptions {
overrideRenderingPolicy = OverrideRenderingPolicy.RENDER_OVERRIDE
unitReturnType = false
typeNormalizer = IdeDescriptorRenderers.APPROXIMATE_FLEXIBLE_TYPES
renderUnabbreviatedType = false
}
private fun generateProperty(project: Project, descriptor: PropertyDescriptor, bodyType: OverrideMemberChooserObject.BodyType): KtProperty {
@@ -0,0 +1,9 @@
typealias Foo = Int
interface Bar {
fun test(foo: Foo) = Unit
}
class Bar2 : Bar {
<caret>
}
@@ -0,0 +1,11 @@
typealias Foo = Int
interface Bar {
fun test(foo: Foo) = Unit
}
class Bar2 : Bar {
override fun test(foo: Foo) {
<selection><caret>super.test(foo)</selection>
}
}
@@ -259,4 +259,8 @@ class OverrideImplementTest : AbstractOverrideImplementTest() {
fun testAbstractAndNonAbstractInheritedFromInterface() {
doImplementFileTest("getFoo")
}
fun testTypeAliasNotExpanded() {
doOverrideFileTest("test")
}
}