Initial implementation of KT-5955 Completion for override methods

#KT-5955 Fixed
This commit is contained in:
Valentin Kipyatkov
2015-09-24 12:33:59 +03:00
parent 15edbbb60c
commit 1c6ca9d036
31 changed files with 599 additions and 117 deletions
@@ -0,0 +1,12 @@
interface I<T> {
fun foo(t: T): T
}
class A<T> : List<String>, I<T> {
o<caret>
}
// EXIST: { lookupString: "override", itemText: "override" }
// EXIST: { itemText: "override fun hashCode(): Int {...}", tailText: null, typeText: "Any" }
// EXIST: { itemText: "override fun foo(t: T): T {...}", tailText: null, typeText: "I" }
// EXIST: { itemText: "override fun get(index: Int): String {...}", tailText: null, typeText: "List" }
@@ -0,0 +1,22 @@
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(overr<caret>) : Base2(), I
// EXIST: { lookupString: "override", itemText: "override" }
// EXIST: { itemText: "override val someVal: Int", tailText: null, typeText: "I" }
// EXIST: { itemText: "override var someVar: Int", tailText: null, typeText: "I" }
// EXIST: { itemText: "override val fromBase: String", tailText: null, typeText: "Base1" }
// EXIST_JAVA_ONLY: { lookupString: "override", itemText: "override: Override" }
// 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 {
o<caret>
}
// EXIST: { lookupString: "override", itemText: "override" }
// EXIST: { itemText: "override fun bar() {...}", lookupString: "override", tailText: null, typeText: "Base1" }
// EXIST: { itemText: "override fun equals(other: Any?): Boolean {...}", lookupString: "override", tailText: null, typeText: "Any" }
// EXIST: { itemText: "override fun foo() {...}", lookupString: "override", tailText: null, typeText: "I" }
// EXIST: { itemText: "override fun hashCode(): Int {...}", lookupString: "override", tailText: null, typeText: "Any" }
// EXIST: { itemText: "override val someVal: Int", lookupString: "override", tailText: null, typeText: "I" }
// EXIST: { itemText: "override var someVar: Int", lookupString: "override", tailText: null, typeText: "I" }
@@ -0,0 +1,9 @@
interface I {
fun foo(p: Int)
}
class A : I {
o<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>throw UnsupportedOperationException()</selection>
}
}
// ELEMENT_TEXT: "override fun foo(p: Int) {...}"
@@ -0,0 +1,9 @@
interface I {
val someVal: String?
}
class A : I {
o<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,9 @@
interface I {
var someVar: String
}
class A : I {
o<caret>
}
// ELEMENT_TEXT: "override var someVar: String"
@@ -0,0 +1,12 @@
interface I {
var someVar: String
}
class A : I {
override var someVar: String
get() = <caret><selection>throw UnsupportedOperationException()</selection>
set(value) {
}
}
// ELEMENT_TEXT: "override var someVar: String"
@@ -0,0 +1,6 @@
class A {
@Deprecated("")
o<caret>
}
// ELEMENT_TEXT: "override fun equals(other: Any?): Boolean {...}"
@@ -0,0 +1,8 @@
class A {
@Deprecated("")
override fun equals(other: Any?): Boolean {
<caret><selection>return super.equals(other)</selection>
}
}
// ELEMENT_TEXT: "override fun equals(other: Any?): Boolean {...}"
@@ -0,0 +1,6 @@
class A {
@Deprecated("") // it is deprecated
public o<caret>
}
// ELEMENT_TEXT: "override 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 fun equals(other: Any?): Boolean {...}"
@@ -0,0 +1,5 @@
class A {
o<caret>
}
// ELEMENT_TEXT: "override fun equals(other: Any?): Boolean {...}"
@@ -0,0 +1,7 @@
class A {
override fun equals(other: Any?): Boolean {
<caret><selection>return super.equals(other)</selection>
}
}
// ELEMENT_TEXT: "override fun equals(other: Any?): Boolean {...}"
@@ -0,0 +1,9 @@
open class B {
open var someVar: String = ""
}
class A : B {
o<caret>
}
// ELEMENT_TEXT: "override var someVar: String"
@@ -0,0 +1,12 @@
open class B {
open var someVar: String = ""
}
class A : B {
override var someVar: String
get() = <caret><selection>super.someVar</selection>
set(value) {
}
}
// ELEMENT_TEXT: "override var someVar: String"
@@ -0,0 +1,8 @@
interface I {
val someVal: java.io.File?
}
class A(public ov<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(public override val someVal: File?<caret>) : I {
}
// ELEMENT_TEXT: "override val someVal: File?"
@@ -0,0 +1,8 @@
interface I {
val someVal: java.io.File?
}
class A(ov<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?"