Correct handling of empty super type list while adding an entry #KT-12011 Fixed

This commit is contained in:
Mikhail Glukhikh
2016-04-27 17:58:38 +03:00
parent 5c9d6fd460
commit 918f843cd0
4 changed files with 28 additions and 0 deletions
@@ -38,6 +38,10 @@ abstract class KtClassOrObject :
fun addSuperTypeListEntry(superTypeListEntry: KtSuperTypeListEntry): KtSuperTypeListEntry {
getSuperTypeList()?.let {
val single = it.entries.singleOrNull()
if (single != null && single.typeReference?.typeElement == null) {
return single.replace(superTypeListEntry) as KtSuperTypeListEntry
}
return EditCommaSeparatedListHelper.addItem(it, getSuperTypeListEntries(), superTypeListEntry)
}