Create from Usage: Add delegation call to secondary constructor declaration

This commit is contained in:
Alexey Sedunov
2016-02-05 16:27:11 +03:00
parent 6696d2b70a
commit eabe675dbf
9 changed files with 75 additions and 7 deletions
@@ -0,0 +1,7 @@
// "Create secondary constructor" "true"
open class Base()
class Creation {
constructor(f: Int)
}
val v = Creation(<caret>)
@@ -1,7 +1,9 @@
// "Create secondary constructor" "true"
// ERROR: Primary constructor call expected
class Creation(val f: Int) {
open class Base()
class Creation {
constructor(f: Int)
constructor()
}
val v = Creation()
@@ -0,0 +1,9 @@
// "Create secondary constructor" "true"
// SHOULD_BE_AVAILABLE_AFTER_EXECUTION
// ERROR: No value passed for parameter f
open class Base(val f: Int)
class Creation: Base {
constructor(f: Int): super(f)
}
val v = Creation(<caret>)
@@ -0,0 +1,11 @@
// "Create secondary constructor" "true"
// SHOULD_BE_AVAILABLE_AFTER_EXECUTION
// ERROR: No value passed for parameter f
open class Base(val f: Int)
class Creation: Base {
constructor(f: Int): super(f)
constructor() : super(<caret>)
}
val v = Creation()
@@ -1,4 +1,4 @@
// "Create secondary constructor" "true"
// ERROR: Primary constructor call expected
// ERROR: There's a cycle in the delegation calls chain
class Creation(val f: Int)
val v = Creation(<caret>)
@@ -0,0 +1,7 @@
// "Create secondary constructor" "true"
// ERROR: There's a cycle in the delegation calls chain
class Creation(val f: Int) {
constructor() : this(<caret>)
}
val v = Creation()