Add quickfixes inserting explicit delegation calls

#KT-6963 Fixed
This commit is contained in:
Denis Zharkov
2015-03-23 15:17:26 +03:00
parent d0c72c2c3d
commit b1de2066c7
21 changed files with 283 additions and 6 deletions
@@ -0,0 +1,8 @@
// "Insert 'super()' call" "true"
// ERROR: No value passed for parameter x
open class B(val x: Int)
class A : B {
constructor(x: String) : super(<caret>)
}
@@ -0,0 +1,9 @@
// "Insert 'this()' call" "true"
open class B(val x: Int)
class A : B {
constructor(x: String)<caret> : this()
constructor() : super(1)
}
@@ -0,0 +1,10 @@
// "Insert 'this()' call" "true"
// ERROR: There's a cycle in the delegation calls chain
open class B(val x: Int)
class A : B {
constructor() : this(<caret>)
constructor(x: String) : super(1)
}
@@ -0,0 +1,5 @@
// "Insert 'this()' call" "true"
class A() {
constructor(x: String)<caret> : this()
}
@@ -0,0 +1,7 @@
// "Insert 'this()' call" "true"
class A() {
constructor(x: String)<caret> : this() {
}
}
@@ -0,0 +1,6 @@
// "Insert 'this()' call" "true"
// ERROR: <html>None of the following functions can be called with the arguments supplied. <ul><li><init>(<font color=red><b>String</b></font>) <i>defined in</i> A</li><li><init>(<font color=red><b>Int</b></font>) <i>defined in</i> A</li></ul></html>
class A(val x: Int) {
constructor(x: String) : this(<caret>)
}
@@ -0,0 +1,8 @@
// "Insert 'super()' call" "true"
// ERROR: No value passed for parameter x
open class B(val x: Int)
class A : B {
constructor(x: String)<caret>
}
@@ -0,0 +1,9 @@
// "Insert 'this()' call" "true"
open class B(val x: Int)
class A : B {
constructor(x: String)<caret>
constructor() : super(1)
}
@@ -0,0 +1,10 @@
// "Insert 'this()' call" "true"
// ERROR: There's a cycle in the delegation calls chain
open class B(val x: Int)
class A : B {
constructor()<caret>
constructor(x: String) : super(1)
}
@@ -0,0 +1,9 @@
// "Insert 'this()' call" "false"
// ACTION: Insert 'super()' call
// ERROR: Explicit 'this' or 'super' call is required. There is no constructor in superclass that can be called without arguments
open class B(val x: Int)
class A : B {
constructor(x: String)<caret>
}
@@ -0,0 +1,9 @@
// "Insert 'super()' call" "false"
// ACTION: Insert 'this()' call
// ERROR: Primary constructor call expected
open class B()
class A(val x: Int) : B() {
constructor(x: String)<caret>
}
@@ -0,0 +1,5 @@
// "Insert 'this()' call" "true"
class A() {
constructor(x: String)<caret>
}
@@ -0,0 +1,7 @@
// "Insert 'this()' call" "true"
class A() {
constructor(x: String)<caret> {
}
}
@@ -0,0 +1,6 @@
// "Insert 'this()' call" "true"
// ERROR: <html>None of the following functions can be called with the arguments supplied. <ul><li><init>(<font color=red><b>String</b></font>) <i>defined in</i> A</li><li><init>(<font color=red><b>Int</b></font>) <i>defined in</i> A</li></ul></html>
class A(val x: Int) {
constructor(x: String)<caret>
}