Code completion of "this@..."

#KT-2035 Fixed
This commit is contained in:
Valentin Kipyatkov
2014-12-26 02:09:08 +03:00
parent 2adcaef39c
commit 3b0fe8831b
21 changed files with 321 additions and 146 deletions
@@ -0,0 +1,11 @@
class Outer {
inner class Inner {
fun String.foo() {
t<caret>
}
}
}
// COMPLETION_TYPE: BASIC
// ELEMENT: *
// CHAR: @
@@ -0,0 +1,11 @@
class Outer {
inner class Inner {
fun String.foo() {
t@<caret>
}
}
}
// COMPLETION_TYPE: BASIC
// ELEMENT: *
// CHAR: @
@@ -16,10 +16,9 @@ fun foo(p: Int) {
// EXIST: package
// EXIST: return
// EXIST: super
// EXIST: this
// EXIST: throw
// EXIST: true
// EXIST: try
// EXIST: when
// EXIST: while
// NUMBER: 17
// NUMBER: 16
@@ -15,7 +15,6 @@ fun foo() {
// EXIST: package
// EXIST: return
// EXIST: super
// EXIST: this
// EXIST: throw
// EXIST: trait
// EXIST: true
@@ -24,4 +23,4 @@ fun foo() {
// EXIST: var
// EXIST: when
// EXIST: while
// NUMBER: 22
// NUMBER: 21
@@ -11,10 +11,9 @@ fun foo() = <caret>
// EXIST: package
// EXIST: return
// EXIST: super
// EXIST: this
// EXIST: throw
// EXIST: true
// EXIST: try
// EXIST: when
// EXIST: while
// NUMBER: 17
// NUMBER: 16
@@ -12,10 +12,9 @@ val prop: Int
// EXIST: package
// EXIST: return
// EXIST: super
// EXIST: this
// EXIST: throw
// EXIST: true
// EXIST: try
// EXIST: when
// EXIST: while
// NUMBER: 17
// NUMBER: 16
@@ -11,10 +11,9 @@ fun foo(p: Int = <caret>)
// EXIST: package
// EXIST: return
// EXIST: super
// EXIST: this
// EXIST: throw
// EXIST: true
// EXIST: try
// EXIST: when
// EXIST: while
// NUMBER: 17
// NUMBER: 16
@@ -11,10 +11,9 @@ var a : Int = <caret>
// EXIST: package
// EXIST: return
// EXIST: super
// EXIST: this
// EXIST: throw
// EXIST: true
// EXIST: try
// EXIST: when
// EXIST: while
// NUMBER: 17
// NUMBER: 16
@@ -0,0 +1,13 @@
class Outer {
inner class Inner {
fun String.foo() {
this@<caret>
}
}
}
// ABSENT: this
// ABSENT: "this@foo"
// EXIST: { lookupString: "this@Inner", itemText: "this", tailText: "@Inner", typeText: "Outer.Inner", attributes: "bold" }
// EXIST: { lookupString: "this@Outer", itemText: "this", tailText: "@Outer", typeText: "Outer", attributes: "bold" }
// NUMBER: 2
+28
View File
@@ -0,0 +1,28 @@
class Outer {
class Nested {
inner class Inner {
fun String.foo() {
takeHandler1 {
takeHandler2({
takeHandler3 { this<caret> }
})
}
}
}
}
}
fun takeHandler1(handler: Int.() -> Unit){}
fun takeHandler2(handler: Char.() -> Unit){}
fun takeHandler3(handler: Char.() -> Unit){}
// INVOCATION_COUNT: 1
// EXIST: { lookupString: "this", itemText: "this", tailText: null, typeText: "Char", attributes: "bold" }
// ABSENT: "this@takeHandler3"
// EXIST: { lookupString: "this@takeHandler2", itemText: "this", tailText: "@takeHandler2", typeText: "Char", attributes: "bold" }
// EXIST: { lookupString: "this@takeHandler1", itemText: "this", tailText: "@takeHandler1", typeText: "Int", attributes: "bold" }
// EXIST: { lookupString: "this@foo", itemText: "this", tailText: "@foo", typeText: "String", attributes: "bold" }
// EXIST: { lookupString: "this@Inner", itemText: "this", tailText: "@Inner", typeText: "Outer.Nested.Inner", attributes: "bold" }
// EXIST: { lookupString: "this@Nested", itemText: "this", tailText: "@Nested", typeText: "Outer.Nested", attributes: "bold" }
// ABSENT: "this@Outer"
// NUMBER: 6
@@ -0,0 +1,12 @@
fun is1(): Boolean{}
fun is2(): Boolean{}
class Outer {
inner class Inner {
fun String.foo() {
is<caret>
}
}
}
// NUMBER: 0
@@ -1,7 +1,13 @@
class Foo{
fun String.foo(){
val foo : Foo = <caret>
class Outer {
inner class Inner {
fun String.foo() {
val v: Any = this@<caret>
}
}
}
// EXIST: { lookupString:"this@Foo", typeText:"Foo" }
// ABSENT: this
// ABSENT: "this@foo"
// EXIST: { lookupString: "this@Inner", itemText: "this", tailText: "@Inner", typeText: "Outer.Inner", attributes: "bold" }
// EXIST: { lookupString: "this@Outer", itemText: "this", tailText: "@Outer", typeText: "Outer", attributes: "bold" }
// NUMBER: 2
+28 -3
View File
@@ -1,5 +1,30 @@
fun String.foo(){
val s : String = <caret>
class Outer {
class Nested {
inner class Inner {
fun String.foo() {
takeHandler1 {
takeHandler2({
takeHandler3 {
takeHandler4 { val v: Any = <caret> }
}
})
}
}
}
}
}
// EXIST: { lookupString:"this", typeText:"String" }
fun takeHandler1(handler: Int.() -> Unit){}
fun takeHandler2(handler: Char.() -> Unit){}
fun takeHandler3(handler: Any?.() -> Unit){}
fun takeHandler4(handler: Any.() -> Unit){}
// EXIST: { lookupString: "this", itemText: "this", tailText: null, typeText: "Any", attributes: "bold" }
// ABSENT: "this@takeHandler4"
// ABSENT: "this@takeHandler3"
// EXIST: { lookupString: "this@takeHandler2", itemText: "this", tailText: "@takeHandler2", typeText: "Char", attributes: "bold" }
// EXIST: { lookupString: "this@takeHandler1", itemText: "this", tailText: "@takeHandler1", typeText: "Int", attributes: "bold" }
// EXIST: { lookupString: "this@foo", itemText: "this", tailText: "@foo", typeText: "String", attributes: "bold" }
// EXIST: { lookupString: "this@Inner", itemText: "this", tailText: "@Inner", typeText: "Outer.Nested.Inner", attributes: "bold" }
// EXIST: { lookupString: "this@Nested", itemText: "this", tailText: "@Nested", typeText: "Outer.Nested", attributes: "bold" }
// ABSENT: "this@Outer"