Create from Usage: Generate secondary constructors by delegation calls

This commit is contained in:
Alexey Sedunov
2015-03-25 15:41:10 +03:00
parent 9c0bcee9a3
commit e8b4c43011
14 changed files with 184 additions and 5 deletions
@@ -0,0 +1,14 @@
// "Create secondary constructor" "true"
open class A {
constructor(i: Int) {
//To change body of created constructors use File | Settings | File Templates.
}
}
class B: A {
constructor(): super(1) {
}
}
@@ -0,0 +1,11 @@
// "Create secondary constructor" "true"
class A {
constructor(): this(1) {
}
constructor(i: Int) {
//To change body of created constructors use File | Settings | File Templates.
}
}
@@ -0,0 +1,11 @@
// "Create secondary constructor" "true"
open class A {
}
class B: A {
constructor(): super(<caret>1) {
}
}
@@ -0,0 +1,12 @@
// "Create secondary constructor" "false"
// ERROR: Too many arguments for public constructor Any() defined in kotlin.Any
trait T {
}
class A: T {
constructor(): super(<caret>1) {
}
}
@@ -0,0 +1,7 @@
// "Create secondary constructor" "true"
class A {
constructor(): this(<caret>1) {
}
}
@@ -0,0 +1,6 @@
class J {
public J(int i) {
}
}
@@ -0,0 +1,8 @@
// "Create secondary constructor" "true"
// ERROR: Too many arguments for public/*package*/ constructor J() defined in J
class B: J {
constructor(): super(1) {
}
}
@@ -0,0 +1,8 @@
// "Create secondary constructor" "true"
// ERROR: Too many arguments for public/*package*/ constructor J() defined in J
class B: J {
constructor(): super(<caret>1) {
}
}