Create from Usage: Do not generate secondary constructor body by default

This commit is contained in:
Alexey Sedunov
2016-02-05 16:23:57 +03:00
parent cc2a65e874
commit 6696d2b70a
8 changed files with 8 additions and 21 deletions
@@ -462,6 +462,7 @@ class CallableBuilder(val config: CallableBuilderConfiguration) {
CallableKind.FUNCTION, CallableKind.SECONDARY_CONSTRUCTOR -> {
val body = when {
containingElement is KtClass && containingElement.isInterface() && !config.isExtension -> ""
callableInfo.kind == CallableKind.SECONDARY_CONSTRUCTOR -> ""
else -> "{}"
}
@Suppress("USELESS_CAST") // KT-10755
@@ -3,9 +3,7 @@
interface T
class A: T {
constructor(i: Int) {
//To change body of created constructors use File | Settings | File Templates.
}
constructor(i: Int)
}
fun test() {
@@ -1,9 +1,7 @@
// "Create secondary constructor" "true"
class A {
constructor(i: Int) {
//To change body of created constructors use File | Settings | File Templates.
}
constructor(i: Int)
}
@@ -1,9 +1,7 @@
// "Create secondary constructor" "true"
class A {
constructor(i: Int) {
//To change body of created constructors use File | Settings | File Templates.
}
constructor(i: Int)
}
fun test() {
@@ -1,9 +1,7 @@
// "Create secondary constructor" "true"
open class A {
constructor(i: Int) {
//To change body of created constructors use File | Settings | File Templates.
}
constructor(i: Int)
}
@@ -1,9 +1,7 @@
// "Create secondary constructor" "true"
// ERROR: Primary constructor call expected
class Creation(val f: Int) {
constructor() {
//To change body of created constructors use File | Settings | File Templates.
}
constructor()
}
val v = Creation()
@@ -1,9 +1,7 @@
// "Create secondary constructor" "true"
open class A {
constructor(i: Int) {
//To change body of created constructors use File | Settings | File Templates.
}
constructor(i: Int)
}
@@ -5,7 +5,5 @@ class A {
}
constructor(i: Int) {
//To change body of created constructors use File | Settings | File Templates.
}
constructor(i: Int)
}