Create from Usage: Do not generate secondary constructor body by default
This commit is contained in:
+1
@@ -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
|
||||
|
||||
Vendored
+1
-3
@@ -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
-3
@@ -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)
|
||||
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
-3
@@ -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() {
|
||||
|
||||
Vendored
+1
-3
@@ -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
-3
@@ -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
-3
@@ -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
-3
@@ -5,7 +5,5 @@ class A {
|
||||
|
||||
}
|
||||
|
||||
constructor(i: Int) {
|
||||
//To change body of created constructors use File | Settings | File Templates.
|
||||
}
|
||||
constructor(i: Int)
|
||||
}
|
||||
Reference in New Issue
Block a user