KT-13298 Suggest names for overridden properties / functions in completion

#KT-13298 Fixed
This commit is contained in:
Valentin Kipyatkov
2016-08-15 19:17:33 +03:00
parent 7ebf001d25
commit 7f07890f6a
20 changed files with 319 additions and 33 deletions
@@ -0,0 +1,27 @@
interface I {
fun foo()
val someVal: Int
var someVar: Int
}
class Base1 {
protected open fun bar(){}
}
open class Base2 : Base1() {
}
class A : Base2(), I {
fun x() {
unresolved1(unresolved2)
}
override fun <caret>
}
// EXIST: { itemText: "override fun bar() {...}", lookupString: "bar", tailText: null, typeText: "Base1", attributes: "" }
// EXIST: { itemText: "override fun foo() {...}", lookupString: "foo", tailText: null, typeText: "I", attributes: "bold" }
// EXIST: { itemText: "override operator fun equals(other: Any?): Boolean {...}", lookupString: "equals", tailText: null, typeText: "Any", attributes: "" }
// EXIST: { itemText: "override fun hashCode(): Int {...}", lookupString: "hashCode", tailText: null, typeText: "Any", attributes: "" }
// EXIST: { itemText: "override fun toString(): String {...}", lookupString: "toString", tailText: null, typeText: "Any", attributes: "" }
// NOTHING_ELSE
@@ -0,0 +1,23 @@
interface I {
fun foo()
val someVal: Int
var someVar: Int
}
class Base1 {
protected open fun bar(){}
}
open class Base2 : Base1() {
}
class A : Base2(), I {
fun x() {
unresolved1(unresolved2)
}
override val <caret>
}
// EXIST: { itemText: "override val someVal: Int", lookupString: "someVal", tailText: null, typeText: "I", attributes: "bold" }
// NOTHING_ELSE
@@ -0,0 +1,19 @@
interface I {
fun foo()
val someVal: Int
var someVar: Int
}
class Base1 {
protected open fun bar(){}
open val fromBase: String = ""
}
open class Base2 : Base1() {
}
class A(override val <caret>) : Base2(), I
// EXIST: { itemText: "override val someVal: Int", tailText: null, typeText: "I", attributes: "bold" }
// EXIST: { itemText: "override val fromBase: String", tailText: null, typeText: "Base1", attributes: "" }
// NOTHING_ELSE
@@ -0,0 +1,24 @@
interface I {
fun foo()
val someVal: Int
var someVar: Int
}
class Base1 {
protected open fun bar(){}
}
open class Base2 : Base1() {
}
class A : Base2(), I {
fun x() {
unresolved1(unresolved2)
}
override var <caret>
}
// EXIST: { itemText: "override val someVal: Int", lookupString: "someVal", tailText: null, typeText: "I", attributes: "bold" }
// EXIST: { itemText: "override var someVar: Int", lookupString: "someVar", tailText: null, typeText: "I", attributes: "bold" }
// NOTHING_ELSE
@@ -0,0 +1,10 @@
interface I {
fun ov_foo()
}
class A : I {
override fun ov<caret>
}
// ABSENT: override
// EXIST: { itemText: "override fun ov_foo() {...}", allLookupStrings: "ov_foo", tailText: null, typeText: "I", attributes: "bold" }
@@ -16,9 +16,9 @@ class A : Base2(), I {
}
// EXIST: { lookupString: "override", itemText: "override" }
// EXIST: { itemText: "override fun bar() {...}", lookupString: "override", tailText: null, typeText: "Base1", attributes: "" }
// EXIST: { itemText: "override operator fun equals(other: Any?): Boolean {...}", lookupString: "override", tailText: null, typeText: "Any", attributes: "" }
// EXIST: { itemText: "override fun foo() {...}", lookupString: "override", tailText: null, typeText: "I", attributes: "bold" }
// EXIST: { itemText: "override fun hashCode(): Int {...}", lookupString: "override", tailText: null, typeText: "Any", attributes: "" }
// EXIST: { itemText: "override val someVal: Int", lookupString: "override", tailText: null, typeText: "I", attributes: "bold" }
// EXIST: { itemText: "override var someVar: Int", lookupString: "override", tailText: null, typeText: "I", attributes: "bold" }
// EXIST: { itemText: "override fun bar() {...}", lookupString: "override", allLookupStrings: "bar, override", tailText: null, typeText: "Base1", attributes: "" }
// EXIST: { itemText: "override operator fun equals(other: Any?): Boolean {...}", lookupString: "override", allLookupStrings: "equals, override", tailText: null, typeText: "Any", attributes: "" }
// EXIST: { itemText: "override fun foo() {...}", lookupString: "override", allLookupStrings: "foo, override", tailText: null, typeText: "I", attributes: "bold" }
// EXIST: { itemText: "override fun hashCode(): Int {...}", lookupString: "override", allLookupStrings: "hashCode, override", tailText: null, typeText: "Any", attributes: "" }
// EXIST: { itemText: "override val someVal: Int", lookupString: "override", allLookupStrings: "override, someVal", tailText: null, typeText: "I", attributes: "bold" }
// EXIST: { itemText: "override var someVar: Int", lookupString: "override", allLookupStrings: "override, someVar", tailText: null, typeText: "I", attributes: "bold" }
@@ -0,0 +1,9 @@
interface I {
fun foo(p: Int)
}
class A : I {
override fun f<caret>
}
// ELEMENT_TEXT: "override fun foo(p: Int) {...}"
@@ -0,0 +1,11 @@
interface I {
fun foo(p: Int)
}
class A : I {
override fun foo(p: Int) {
<caret><selection>TODO("not implemented") //To change body of created functions use File | Settings | File Templates.</selection>
}
}
// ELEMENT_TEXT: "override fun foo(p: Int) {...}"
@@ -0,0 +1,6 @@
class A {
@Deprecated("") // it is deprecated
public override fun e<caret>
}
// ELEMENT_TEXT: "override operator fun equals(other: Any?): Boolean {...}"
@@ -0,0 +1,8 @@
class A {
@Deprecated("") // it is deprecated
public override fun equals(other: Any?): Boolean {
<caret><selection>return super.equals(other)</selection>
}
}
// ELEMENT_TEXT: "override operator fun equals(other: Any?): Boolean {...}"
@@ -0,0 +1,9 @@
interface I {
val someVal: String?
}
class A : I {
override val <caret>
}
// ELEMENT_TEXT: "override val someVal: String?"
@@ -0,0 +1,10 @@
interface I {
val someVal: String?
}
class A : I {
override val someVal: String?
get() = <caret><selection>throw UnsupportedOperationException()</selection>
}
// ELEMENT_TEXT: "override val someVal: String?"
@@ -0,0 +1,8 @@
interface I {
val someVal: java.io.File?
}
class A(override val s<caret>) : I {
}
// ELEMENT_TEXT: "override val someVal: File?"
@@ -0,0 +1,10 @@
import java.io.File
interface I {
val someVal: java.io.File?
}
class A(override val someVal: File?<caret>) : I {
}
// ELEMENT_TEXT: "override val someVal: File?"
@@ -4,7 +4,7 @@ interface I {
class A : I {
override fun foo(p: Int) {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
<caret><selection>TODO("not implemented") //To change body of created functions use File | Settings | File Templates.</selection>
}
}