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:
@@ -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) } },
|
||||
|
||||
+1
@@ -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")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user