Add annotations to primary constructor together with 'constructor'

This fixes incorrect behaviour if primary constructor has no explicit
'constructor' keywork
#KT-25548 Fixed
This commit is contained in:
Mikhail Glukhikh
2018-08-20 17:22:42 +03:00
parent c12f29ae30
commit 564ea629d1
5 changed files with 40 additions and 4 deletions
@@ -62,9 +62,8 @@ class KtPrimaryConstructor : KtConstructor<KtPrimaryConstructor> {
return if (modifierList != null) {
modifierList.addBefore(annotationEntry, modifierList.firstChild) as KtAnnotationEntry
} else {
val parameterList = valueParameterList!!
val newModifierList = KtPsiFactory(project).createModifierList(annotationEntry.text)
(addBefore(newModifierList, parameterList) as KtModifierList).annotationEntries.first()
(addBefore(newModifierList, getOrCreateConstructorKeyword()) as KtModifierList).annotationEntries.first()
}
}
}