Add "Find Usages" tests for nested/inner classes and objects

This commit is contained in:
Alexey Sedunov
2013-11-01 19:32:35 +04:00
parent f99e6e6765
commit bc9b2bf657
16 changed files with 331 additions and 0 deletions
@@ -0,0 +1,11 @@
// PSI_ELEMENT: com.intellij.psi.PsiClass
// OPTIONS: usages
public class Outer {
public class <caret>A {
public String bar = "bar";
public void foo() {
}
}
}
@@ -0,0 +1,31 @@
public class KOuter: Outer() {
public inner class X(bar: String? = (this@KOuter : Outer).A().bar): Outer.A() {
var next: Outer.A? = (this@KOuter : Outer).A()
val myBar: String? = (this@KOuter : Outer).A().bar
{
(this@KOuter : Outer).A().bar = ""
}
fun foo(a: Outer.A) {
val aa: Outer.A = a
aa.bar = ""
}
fun getNext(): Outer.A? {
return next
}
public override fun foo() {
super<Outer.A>.foo()
}
}
}
fun KOuter.X.bar(a: Outer.A = Outer().A()) {
}
fun Any.toA(): Outer.A? {
return if (this is Outer.A) this as Outer.A else null
}
@@ -0,0 +1,15 @@
Class/object property type (3: 25) var next: Outer.A? = (this@KOuter : Outer).A()
Function return types (15: 30) fun getNext(): Outer.A? {
Function return types (29: 22) fun Any.toA(): Outer.A? {
Local variable declaration (11: 27) val aa: Outer.A = a
New instance creation (25: 39) fun KOuter.X.bar(a: Outer.A = Outer().A()) {
New instance creation (2: 63) public inner class X(bar: String? = (this@KOuter : Outer).A().bar): Outer.A() {
New instance creation (3: 52) var next: Outer.A? = (this@KOuter : Outer).A()
New instance creation (4: 52) val myBar: String? = (this@KOuter : Outer).A().bar
New instance creation (7: 35) (this@KOuter : Outer).A().bar = ""
Parameter type (10: 26) fun foo(a: Outer.A) {
Parameter type (25: 27) fun KOuter.X.bar(a: Outer.A = Outer().A()) {
Super type qualifier (20: 25) super<Outer.A>.foo()
Supertype (2: 79) public inner class X(bar: String? = (this@KOuter : Outer).A().bar): Outer.A() {
Target type of 'is' operation (30: 30) return if (this is Outer.A) this as Outer.A else null
Usage in cast target type (30: 47) return if (this is Outer.A) this as Outer.A else null
@@ -0,0 +1,17 @@
// PSI_ELEMENT: com.intellij.psi.PsiClass
// OPTIONS: usages
public class Outer {
public static class <caret>A {
public String bar = "bar";
public static String BAR = "BAR";
public void foo() {
}
public static void foos() {
}
}
}
@@ -0,0 +1,38 @@
public class X(bar: String? = Outer.A.BAR): Outer.A() {
var next: Outer.A? = Outer.A()
val myBar: String? = Outer.A.BAR
{
Outer.A.BAR = ""
Outer.A.foos()
}
fun foo(a: Outer.A) {
val aa: Outer.A = a
aa.bar = ""
}
fun getNext(): Outer.A? {
return next
}
public override fun foo() {
super<Outer.A>.foo()
}
class object: Outer.A() {
}
}
object O: Outer.A() {
}
fun X.bar(a: Outer.A = Outer.A()) {
}
fun Any.toA(): Outer.A? {
return if (this is Outer.A) this as Outer.A else null
}
@@ -0,0 +1,18 @@
Class/object property type (2: 21) var next: Outer.A? = Outer.A()
Function return types (15: 26) fun getNext(): Outer.A? {
Function return types (36: 22) fun Any.toA(): Outer.A? {
Local variable declaration (11: 23) val aa: Outer.A = a
Nested class/object (1: 37) public class X(bar: String? = Outer.A.BAR): Outer.A() {
Nested class/object (3: 32) val myBar: String? = Outer.A.BAR
Nested class/object (6: 15) Outer.A.BAR = ""
Nested class/object (7: 15) Outer.A.foos()
New instance creation (2: 32) var next: Outer.A? = Outer.A()
New instance creation (32: 30) fun X.bar(a: Outer.A = Outer.A()) {
Parameter type (10: 22) fun foo(a: Outer.A) {
Parameter type (32: 20) fun X.bar(a: Outer.A = Outer.A()) {
Super type qualifier (20: 21) super<Outer.A>.foo()
Supertype (1: 51) public class X(bar: String? = Outer.A.BAR): Outer.A() {
Supertype (23: 25) class object: Outer.A() {
Supertype (28: 17) object O: Outer.A() {
Target type of 'is' operation (37: 30) return if (this is Outer.A) this as Outer.A else null
Usage in cast target type (37: 47) return if (this is Outer.A) this as Outer.A else null