Set primary constructor and its properties actual in "create actual"
So #KT-20044 Fixed
This commit is contained in:
@@ -235,6 +235,15 @@ private fun KtPsiFactory.generateClassOrObject(
|
||||
}
|
||||
actualClass.addDeclaration(actualDeclaration)
|
||||
}
|
||||
|
||||
actualClass.primaryConstructor?.let {
|
||||
it.addModifier(KtTokens.ACTUAL_KEYWORD)
|
||||
for (parameter in it.valueParameters) {
|
||||
if (parameter.hasValOrVar()) {
|
||||
parameter.addModifier(KtTokens.ACTUAL_KEYWORD)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return actualClass.apply {
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
// Ann: to be implemented
|
||||
actual annotation class Ann(val x: Int, val y: String)
|
||||
actual annotation class Ann actual constructor(actual val x: Int, actual val y: String)
|
||||
@@ -0,0 +1,3 @@
|
||||
// "Create actual class for platform JVM" "true"
|
||||
|
||||
expect class <caret>WithPrimaryConstructor(x: Int, s: String)
|
||||
@@ -0,0 +1,3 @@
|
||||
// "Create actual class for platform JVM" "true"
|
||||
|
||||
expect class WithPrimaryConstructor(x: Int, s: String)
|
||||
+1
@@ -0,0 +1 @@
|
||||
// WithPrimaryConstructor: to be implemented
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
// WithPrimaryConstructor: to be implemented
|
||||
actual class WithPrimaryConstructor actual constructor(x: Int, s: String)
|
||||
@@ -1,6 +1,6 @@
|
||||
// Sealed: to be implemented
|
||||
actual sealed class Sealed {
|
||||
actual object Obj : Sealed
|
||||
actual class Klass(x: Int) : Sealed
|
||||
actual class Klass actual constructor(x: Int) : Sealed
|
||||
|
||||
}
|
||||
@@ -129,6 +129,11 @@ class QuickFixMultiModuleTest : AbstractQuickFixMultiModuleTest() {
|
||||
doMultiPlatformTest()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testPrimaryConstructor() {
|
||||
doMultiPlatformTest()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testProperty() {
|
||||
doMultiPlatformTest()
|
||||
|
||||
Reference in New Issue
Block a user