Resolve qualified nested class expressions
lookupNamespaceType now returns NamespaceType of a scope not only of the namespace found by name, but also of the classifier static classes scope found by the same name. This allows correct resolution of expressions "Class.Nested.member()", where Class comes from Java (previously it was resolved into a NamespaceDescriptor with a NamespaceType). NamespaceDescriptor.getNamespaceType() is deleted since there are no sense in namespace's NamespaceType alone anymore. Also some minor refactoring (referencedName param is useless) #KT-1174 In Progress
This commit is contained in:
+14
@@ -0,0 +1,14 @@
|
||||
class Outer {
|
||||
class Nested {
|
||||
class object {
|
||||
fun foo() = 42
|
||||
}
|
||||
}
|
||||
|
||||
class object {
|
||||
fun bar() = 239
|
||||
}
|
||||
}
|
||||
|
||||
fun foo() = Outer.Nested.foo()
|
||||
fun bar() = Outer.bar()
|
||||
@@ -0,0 +1,17 @@
|
||||
class Outer {
|
||||
class Nested {
|
||||
class NestedNested
|
||||
}
|
||||
|
||||
inner class Inner {
|
||||
inner class InnerInner
|
||||
}
|
||||
}
|
||||
|
||||
fun f1() = Outer()
|
||||
fun f2() = Outer.Nested()
|
||||
fun f3() = Outer.Nested.NestedNested()
|
||||
fun f4() = Outer.<!UNRESOLVED_REFERENCE!>Inner<!>()
|
||||
fun f5() = Outer.<!UNRESOLVED_REFERENCE!>Inner<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>InnerInner<!>()
|
||||
fun f6() = Outer().Inner()
|
||||
fun f7() = Outer().Inner().InnerInner()
|
||||
@@ -0,0 +1,5 @@
|
||||
fun bar(b: Boolean) = b
|
||||
|
||||
fun foo(data: List<String>) {
|
||||
bar(data.contains(""))
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
enum class E {
|
||||
E1
|
||||
E2 { }
|
||||
}
|
||||
|
||||
fun foo() = E.E1
|
||||
fun bar() = E.E2
|
||||
@@ -0,0 +1,8 @@
|
||||
class Outer {
|
||||
class Nested<T>
|
||||
}
|
||||
|
||||
fun nested() = Outer.Nested<Int>()
|
||||
fun noArguments() = Outer.<!TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>Nested<!>()
|
||||
fun noArgumentsExpectedType(): Outer.Nested<String> = Outer.Nested()
|
||||
fun manyArguments() = Outer.Nested<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><String, Int><!>()
|
||||
@@ -0,0 +1,17 @@
|
||||
// FILE: a.kt
|
||||
class A {
|
||||
class B {
|
||||
class C
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: b.kt
|
||||
import A.B
|
||||
import A.B.C
|
||||
|
||||
val a = A()
|
||||
val b = B()
|
||||
val ab = A.B()
|
||||
val c = C()
|
||||
val bc = B.C()
|
||||
val abc = A.B.C()
|
||||
@@ -0,0 +1,8 @@
|
||||
package A
|
||||
|
||||
class B {
|
||||
class C {
|
||||
}
|
||||
}
|
||||
|
||||
val a = A.B.C()
|
||||
@@ -0,0 +1,9 @@
|
||||
class A {
|
||||
enum class E {
|
||||
E1
|
||||
E2 { }
|
||||
}
|
||||
}
|
||||
|
||||
fun foo() = A.E.E1
|
||||
fun bar() = A.E.E2
|
||||
@@ -0,0 +1,7 @@
|
||||
object A {
|
||||
object B {
|
||||
object C
|
||||
}
|
||||
}
|
||||
|
||||
val a = A.B.C
|
||||
@@ -0,0 +1,11 @@
|
||||
abstract class Outer {
|
||||
class Nested {
|
||||
class NestedNested
|
||||
}
|
||||
|
||||
abstract val prop1: Nested
|
||||
abstract val prop2: Nested.NestedNested
|
||||
}
|
||||
|
||||
fun foo(): Outer.Nested = null!!
|
||||
val bar: Outer.Nested.NestedNested = null!!
|
||||
Reference in New Issue
Block a user