Supported default objects in class usages.

This commit is contained in:
Evgeny Gerashchenko
2015-03-11 17:58:16 +03:00
parent 8874ad2c96
commit 9bcf9dceef
12 changed files with 127 additions and 24 deletions
@@ -0,0 +1,16 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.JetObjectDeclaration
// OPTIONS: usages
import kotlin.platform.platformStatic
class Foo {
default <caret>object {
fun f() {
}
platformStatic fun s() {
}
val CONST = 42
}
}
@@ -0,0 +1,8 @@
class JavaUsage {
public static void main(String[] args) {
System.out.println(Foo.CONST);
Foo.s();
Foo.Default.f();
Foo foo = new Foo(); // not usage of default object
}
}
@@ -0,0 +1,3 @@
Class static member access (3: 28) System.out.println(Foo.CONST);
Class static member access (4: 9) Foo.s();
Unclassified usage (5: 13) Foo.Default.f();
@@ -0,0 +1,8 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.JetObjectDeclaration
// OPTIONS: usages
class Foo {
default object <caret>Bar {
fun f() {
}
}
}
@@ -0,0 +1,10 @@
fun main(args: Array<String>) {
val p: Foo = Foo() // simple class usage
// default object usages
Foo.f()
val x = Foo
Foo.Bar.f()
val xx = Foo.Bar
}
@@ -0,0 +1,4 @@
Nested class/object (5: 5) Foo.f()
Nested class/object (8: 9) Foo.Bar.f()
Unclassified usage (6: 13) val x = Foo
Unclassified usage (9: 18) val xx = Foo.Bar
@@ -0,0 +1,8 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.JetObjectDeclaration
// OPTIONS: usages
class Foo {
default <caret>object {
fun f() {
}
}
}
@@ -0,0 +1,10 @@
fun main(args: Array<String>) {
val p: Foo = Foo() // simple class usage
// default object usages
Foo.f()
val x = Foo
Foo.Default.f()
val xx = Foo.Default
}
@@ -0,0 +1,4 @@
Nested class/object (5: 5) Foo.f()
Nested class/object (8: 9) Foo.Default.f()
Unclassified usage (6: 13) val x = Foo
Unclassified usage (9: 18) val xx = Foo.Default