Update test data for tower resolution algorithm

- locals win
- unary calls to plus/minus are not supported in favor of unaryPlus/unaryMinus
- unqualified nested classes are temporarily reported as unresolved
- function without receiver win against extension function
- explicit import win against star import
This commit is contained in:
Alexander Udalov
2015-12-09 22:22:36 +03:00
committed by Stanislav Erokhin
parent 66a031f7a0
commit 239502368a
73 changed files with 163 additions and 173 deletions
@@ -4,8 +4,6 @@ internal class A(val result: Int) {
val prop = 2 val prop = 2
val C = 3 val C = 3
} }
object C {
}
constructor() : this(foo() + prop + C) constructor() : this(foo() + prop + C)
} }
@@ -15,7 +15,7 @@ operator fun String.unaryPlus(): Int = 0
fun test() { fun test() {
requireInt(+ "") requireInt(+ "")
requireInt(+ Example()) requireInt(+ Example())
requireString(<!DEPRECATED_UNARY_PLUS_MINUS!>+ ExampleDeprecated()<!>) requireString(<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>+<!> ExampleDeprecated())
} }
fun requireInt(n: Int) {} fun requireInt(n: Int) {}
@@ -26,7 +26,7 @@ class Example2 {
<!INAPPLICABLE_OPERATOR_MODIFIER!>operator<!> fun minus() = this <!INAPPLICABLE_OPERATOR_MODIFIER!>operator<!> fun minus() = this
fun test() { fun test() {
<!DEPRECATED_UNARY_PLUS_MINUS!>+this<!> <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>+<!>this
<!DEPRECATED_UNARY_PLUS_MINUS!>-this<!> <!UNRESOLVED_REFERENCE!>-<!>this
} }
} }
@@ -1,13 +1,13 @@
fun foo(a: (String) -> Unit) { fun foo(<!UNUSED_PARAMETER!>a<!>: (String) -> Unit) {
"".<!INVOKE_EXTENSION_ON_NOT_EXTENSION_FUNCTION!>a<!>() "".<!UNRESOLVED_REFERENCE!>a<!>()
} }
interface A : (String) -> Unit {} interface A : (String) -> Unit {}
fun foo(a: @Extension A) { fun foo(<!UNUSED_PARAMETER!>a<!>: @Extension A) {
// @Extension annotation on an unrelated type shouldn't have any effect on this diagnostic. // @Extension annotation on an unrelated type shouldn't have any effect on this diagnostic.
// Only kotlin.Function{n} type annotated with @Extension should // Only kotlin.Function{n} type annotated with @Extension should
"".<!INVOKE_EXTENSION_ON_NOT_EXTENSION_FUNCTION!>a<!>() "".<!UNRESOLVED_REFERENCE!>a<!>()
} }
+2 -2
View File
@@ -38,7 +38,7 @@ class Example2 {
public operator fun invoke() {} public operator fun invoke() {}
} }
fun a() { fun test() {
var a = Example() var a = Example()
var b = Example() var b = Example()
var c = Example2() var c = Example2()
@@ -107,7 +107,7 @@ open class Anc : Base() {
class Anc2 : Anc() class Anc2 : Anc()
fun b() { fun test2() {
Anc() + Anc() Anc() + Anc()
Anc() <!OPERATOR_MODIFIER_REQUIRED!>-<!> Anc() Anc() <!OPERATOR_MODIFIER_REQUIRED!>-<!> Anc()
Anc2() + Anc2() Anc2() + Anc2()
+2 -2
View File
@@ -1,7 +1,7 @@
package package
public fun a(): kotlin.Unit public fun test(): kotlin.Unit
public fun b(): kotlin.Unit public fun test2(): kotlin.Unit
public open class Anc : Base { public open class Anc : Base {
public constructor Anc() public constructor Anc()
+2 -2
View File
@@ -32,7 +32,7 @@ class Test2<A, B, C>(foo: Any?, bar: Any?) {
class Test3<in A, B, C>(foo: Any?, bar: Any?) { class Test3<in A, B, C>(foo: Any?, bar: Any?) {
val foo = foo ?: this val foo = foo ?: this
private val bar = bar ?: this private val bar = bar ?: this
private val bas = bas() private val bas = <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!><!DEBUG_INFO_MISSING_UNRESOLVED!>bas<!>()<!>
val bas2 = bas2() val bas2 = bas2()
private fun bas(): Int = null!! private fun bas(): Int = null!!
@@ -47,7 +47,7 @@ class Test3<in A, B, C>(foo: Any?, bar: Any?) {
class Test4<A, out B, C>(foo: Any?, bar: Any?) { class Test4<A, out B, C>(foo: Any?, bar: Any?) {
val foo = foo ?: this val foo = foo ?: this
private val bar = bar ?: this private val bar = bar ?: this
private val bas = bas() private val bas = <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!><!DEBUG_INFO_MISSING_UNRESOLVED!>bas<!>()<!>
val bas2 = bas2() val bas2 = bas2()
private fun bas(): Int = null!! private fun bas(): Int = null!!
+2 -2
View File
@@ -37,7 +37,7 @@ public final class Test2</*0*/ A, /*1*/ B, /*2*/ C> {
public final class Test3</*0*/ in A, /*1*/ B, /*2*/ C> { public final class Test3</*0*/ in A, /*1*/ B, /*2*/ C> {
public constructor Test3</*0*/ in A, /*1*/ B, /*2*/ C>(/*0*/ foo: kotlin.Any?, /*1*/ bar: kotlin.Any?) public constructor Test3</*0*/ in A, /*1*/ B, /*2*/ C>(/*0*/ foo: kotlin.Any?, /*1*/ bar: kotlin.Any?)
private final val bar: kotlin.Any private final val bar: kotlin.Any
private final val bas: kotlin.Int private final val bas: [ERROR : Type for bas()]
public final val bas2: kotlin.Int public final val bas2: kotlin.Int
public final val foo: kotlin.Any public final val foo: kotlin.Any
public final fun bar(): kotlin.Int public final fun bar(): kotlin.Int
@@ -54,7 +54,7 @@ public final class Test3</*0*/ in A, /*1*/ B, /*2*/ C> {
public final class Test4</*0*/ A, /*1*/ out B, /*2*/ C> { public final class Test4</*0*/ A, /*1*/ out B, /*2*/ C> {
public constructor Test4</*0*/ A, /*1*/ out B, /*2*/ C>(/*0*/ foo: kotlin.Any?, /*1*/ bar: kotlin.Any?) public constructor Test4</*0*/ A, /*1*/ out B, /*2*/ C>(/*0*/ foo: kotlin.Any?, /*1*/ bar: kotlin.Any?)
private final val bar: kotlin.Any private final val bar: kotlin.Any
private final val bas: kotlin.Int private final val bas: [ERROR : Type for bas()]
public final val bas2: kotlin.Int public final val bas2: kotlin.Int
public final val foo: kotlin.Any public final val foo: kotlin.Any
public final fun bar(): kotlin.Int public final fun bar(): kotlin.Int
@@ -5,7 +5,7 @@ fun foo(<!UNUSED_PARAMETER!>a<!> : Any?) {}
public fun main() { public fun main() {
getT<<!PROJECTION_ON_NON_CLASS_TYPE_ARGUMENT!>*<!>>() getT<<!PROJECTION_ON_NON_CLASS_TYPE_ARGUMENT!>*<!>>()
<!UNRESOLVED_REFERENCE!>ggetT<!><<!PROJECTION_ON_NON_CLASS_TYPE_ARGUMENT, PROJECTION_ON_NON_CLASS_TYPE_ARGUMENT!>*<!>>() <!UNRESOLVED_REFERENCE!>ggetT<!><<!PROJECTION_ON_NON_CLASS_TYPE_ARGUMENT!>*<!>>()
getTT<<!PROJECTION_ON_NON_CLASS_TYPE_ARGUMENT!>*<!>, <!PROJECTION_ON_NON_CLASS_TYPE_ARGUMENT!>*<!>>() getTT<<!PROJECTION_ON_NON_CLASS_TYPE_ARGUMENT!>*<!>, <!PROJECTION_ON_NON_CLASS_TYPE_ARGUMENT!>*<!>>()
getTT<<!PROJECTION_ON_NON_CLASS_TYPE_ARGUMENT!>*<!>, Int>() getTT<<!PROJECTION_ON_NON_CLASS_TYPE_ARGUMENT!>*<!>, Int>()
getTT<Int, <!PROJECTION_ON_NON_CLASS_TYPE_ARGUMENT!>*<!>>() getTT<Int, <!PROJECTION_ON_NON_CLASS_TYPE_ARGUMENT!>*<!>>()
@@ -10,6 +10,6 @@ class A {
} }
fun main() { fun main() {
A::<!MISSING_RECEIVER, EXTENSION_IN_CLASS_REFERENCE_NOT_ALLOWED!>extInt<!> A::<!UNRESOLVED_REFERENCE!>extInt<!>
A::<!MISSING_RECEIVER, EXTENSION_IN_CLASS_REFERENCE_NOT_ALLOWED!>extA<!> A::<!UNRESOLVED_REFERENCE!>extA<!>
} }
@@ -7,7 +7,7 @@ class A {
} }
fun A.main() { fun A.main() {
::<!NESTED_CLASS_SHOULD_BE_QUALIFIED!>Nested<!> ::<!UNRESOLVED_REFERENCE!>Nested<!>
val y = A::Nested val y = A::Nested
checkSubtype<KFunction0<A.Nested>>(y) checkSubtype<KFunction0<A.Nested>>(y)
@@ -8,5 +8,5 @@ fun main() {
A::<!UNRESOLVED_REFERENCE!>bar<!> A::<!UNRESOLVED_REFERENCE!>bar<!>
<!UNRESOLVED_REFERENCE!>B<!>::<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>bar<!> <!UNRESOLVED_REFERENCE!>B<!>::<!OVERLOAD_RESOLUTION_AMBIGUITY!>bar<!>
} }
@@ -14,15 +14,14 @@ class A {
fun A.foo(): String = "A" fun A.foo(): String = "A"
val x0 = A::foo // function A::foo wins by default val x0 = A::<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo<!>
val userOfX0 = x0(A())
val x1 = ofType<(A) -> Unit>(A::foo) val x1 = ofType<(A) -> Unit>(A::foo)
val x2 = ofType<KProperty1<A, Int>>(A::foo) val x2 = ofType<KProperty1<A, Int>>(A::foo)
val x3: KProperty1<A, Int> = A::foo val x3: KProperty1<A, Int> = A::foo
val x4: (A) -> String = A::foo val x4: (A) -> String = A::foo
val y0 = A::bar val y0 = A::<!OVERLOAD_RESOLUTION_AMBIGUITY!>bar<!>
val y1 = ofType<(A) -> Unit>(A::bar) val y1 = ofType<(A) -> Unit>(A::bar)
val y2 = ofType<KProperty1<A, Int>>(A::bar) val y2 = ofType<KProperty1<A, Int>>(A::bar)
val y3: KProperty1<A, Int> = A::bar val y3: KProperty1<A, Int> = A::bar
@@ -1,12 +1,11 @@
package package
public val userOfX0: kotlin.Unit public val x0: [ERROR : Type for A::foo]
public val x0: kotlin.reflect.KFunction1<A, kotlin.Unit>
public val x1: (A) -> kotlin.Unit public val x1: (A) -> kotlin.Unit
public val x2: kotlin.reflect.KProperty1<A, kotlin.Int> public val x2: kotlin.reflect.KProperty1<A, kotlin.Int>
public val x3: kotlin.reflect.KProperty1<A, kotlin.Int> public val x3: kotlin.reflect.KProperty1<A, kotlin.Int>
public val x4: (A) -> kotlin.String public val x4: (A) -> kotlin.String
public val y0: kotlin.reflect.KFunction1<A, kotlin.Unit> public val y0: [ERROR : Type for A::bar]
public val y1: (A) -> kotlin.Unit public val y1: (A) -> kotlin.Unit
public val y2: kotlin.reflect.KProperty1<A, kotlin.Int> public val y2: kotlin.reflect.KProperty1<A, kotlin.Int>
public val y3: kotlin.reflect.KProperty1<A, kotlin.Int> public val y3: kotlin.reflect.KProperty1<A, kotlin.Int>
@@ -14,12 +14,11 @@ enum class C {
E4 { E4 {
fun c() { fun c() {
//TODO: this is a bug this.B()
this.<!UNRESOLVED_REFERENCE!>B<!>()
C.A() C.A()
A() A()
//TODO: this is a bug //TODO: should be resolved with error
this.<!UNRESOLVED_REFERENCE!>A<!>() this.<!UNRESOLVED_REFERENCE!>A<!>()
} }
}; };
@@ -33,7 +32,7 @@ enum class C {
fun f() { fun f() {
C.E1.<!UNRESOLVED_REFERENCE!>A<!> C.E1.<!UNRESOLVED_REFERENCE!>A<!>
C.E1.<!NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE!>A<!>() C.E1.<!UNRESOLVED_REFERENCE!>A<!>()
C.E2.B() C.E2.B()
C.E2.<!UNRESOLVED_REFERENCE!>O<!> C.E2.<!UNRESOLVED_REFERENCE!>O<!>
@@ -1 +1,2 @@
public final fun sam(/*0*/ p0: dynamic): dynamic public final fun sam(/*0*/ p0: dynamic): dynamic
public final fun sam(/*0*/ name: dynamic, /*1*/ name: dynamic): dynamic
@@ -22,9 +22,9 @@ import p.*
class K: J.C() { class K: J.C() {
fun <!UNSUPPORTED!>dynamic<!>.test() { fun <!UNSUPPORTED!>dynamic<!>.test() {
<!DEBUG_INFO_DYNAMIC!>sam<!>(null) <!DEBUG_INFO_DYNAMIC!>sam<!>(null)
<!INVISIBLE_MEMBER!>sam<!>( <!DEBUG_INFO_DYNAMIC!>sam<!>(
<!NAMED_ARGUMENTS_NOT_ALLOWED, NAMED_PARAMETER_NOT_FOUND!>name<!> = null, name = null,
<!NAMED_ARGUMENTS_NOT_ALLOWED, NAMED_PARAMETER_NOT_FOUND!>name<!> = null <!ARGUMENT_PASSED_TWICE!>name<!> = null
<!NO_VALUE_FOR_PARAMETER!>)<!> <!NO_VALUE_FOR_PARAMETER!>)<!>
} }
@@ -9,9 +9,12 @@ class Foo {
} }
fun main(args: Array<String>) { fun main(args: Array<String>) {
<!TYPE_INFERENCE_PARAMETER_CONSTRAINT_ERROR!>with<!>("", <!TYPE_MISMATCH!>{ with("", {
Foo.<!MISSING_RECEIVER, TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>findByName<!>("") Foo.<!UNRESOLVED_REFERENCE!>findByName<!>("")
}<!>) })
with(Foo) {
findByName("")
}
} }
fun <T> with(t: T, f: T.() -> Unit) {} fun <T> with(t: T, f: T.() -> Unit) {}
+2 -2
View File
@@ -2,7 +2,7 @@
package kt1875 package kt1875
fun f(a : Int?, b : Int.(Int)->Int) = a?.b(1) //unnecessary safe call warning fun foo(a : Int?, b : Int.(Int)->Int) = a?.b(1) //unnecessary safe call warning
interface T { interface T {
val f : ((i: Int) -> Unit)? val f : ((i: Int) -> Unit)?
@@ -14,7 +14,7 @@ fun test(t: T) {
} }
fun test1(t: T?) { fun test1(t: T?) {
t<!UNSAFE_CALL!>.<!><!UNSAFE_CALL!>f<!>(1) t<!UNSAFE_CALL!>.<!><!FUNCTION_EXPECTED!>f<!>(1) // todo resolve f as value and report UNSAFE_CALL
t?.<!UNSAFE_CALL!>f<!>(1) t?.<!UNSAFE_CALL!>f<!>(1)
t<!UNSAFE_CALL!>.<!>f?.invoke(1) t<!UNSAFE_CALL!>.<!>f?.invoke(1)
t?.f?.invoke(1) t?.f?.invoke(1)
+1 -1
View File
@@ -1,7 +1,7 @@
package package
package kt1875 { package kt1875 {
public fun f(/*0*/ a: kotlin.Int?, /*1*/ b: kotlin.Int.(kotlin.Int) -> kotlin.Int): kotlin.Int? public fun foo(/*0*/ a: kotlin.Int?, /*1*/ b: kotlin.Int.(kotlin.Int) -> kotlin.Int): kotlin.Int?
public fun test(/*0*/ t: kt1875.T): kotlin.Unit public fun test(/*0*/ t: kt1875.T): kotlin.Unit
public fun test1(/*0*/ t: kt1875.T?): kotlin.Unit public fun test1(/*0*/ t: kt1875.T?): kotlin.Unit
@@ -15,5 +15,5 @@ import a.X
import b.* import b.*
fun foo() { fun foo() {
<!OVERLOAD_RESOLUTION_AMBIGUITY!>X<!> = 1 X = 1
} }
@@ -5,8 +5,8 @@ package test
import testing.other.* import testing.other.*
import testing.TestFun import testing.TestFun
// Resolve should be ambiguous // Resolve shouldn't be ambiguous
val a = <!OVERLOAD_RESOLUTION_AMBIGUITY!>TestFun<!>() val a = TestFun()
//FILE:testing.kt //FILE:testing.kt
@@ -1,7 +1,7 @@
package package
package test { package test {
public val a: [ERROR : Type for TestFun()] public val a: testing.TestFun
} }
package testing { package testing {
@@ -48,17 +48,17 @@ fun test() {
val ii: I.NI? = null val ii: I.NI? = null
val bc: B.<!UNRESOLVED_REFERENCE!>NC<!> = B.<!UNRESOLVED_REFERENCE!>NC<!>() val bc: B.<!UNRESOLVED_REFERENCE!>NC<!> = B.<!UNRESOLVED_REFERENCE!>NC<!>()
val bic: B.<!UNRESOLVED_REFERENCE!>IC<!> = B().<!UNRESOLVED_REFERENCE!>IC<!>() val bic: B.<!UNRESOLVED_REFERENCE!>IC<!> = B().IC()
val bi: B.<!UNRESOLVED_REFERENCE!>NI<!>? = null val bi: B.<!UNRESOLVED_REFERENCE!>NI<!>? = null
val cc: C.<!UNRESOLVED_REFERENCE!>NC<!> = C.<!UNRESOLVED_REFERENCE!>NC<!>() val cc: C.<!UNRESOLVED_REFERENCE!>NC<!> = C.<!UNRESOLVED_REFERENCE!>NC<!>()
val ci: C.<!UNRESOLVED_REFERENCE!>NI<!>? = null val ci: C.<!UNRESOLVED_REFERENCE!>NI<!>? = null
val dc: D.<!UNRESOLVED_REFERENCE!>NC<!> = D.<!UNRESOLVED_REFERENCE!>NC<!>() val dc: D.<!UNRESOLVED_REFERENCE!>NC<!> = D.<!UNRESOLVED_REFERENCE!>NC<!>()
val dic: D.<!UNRESOLVED_REFERENCE!>IC<!> = D().<!UNRESOLVED_REFERENCE!>IC<!>() val dic: D.<!UNRESOLVED_REFERENCE!>IC<!> = D().IC()
val di: D.<!UNRESOLVED_REFERENCE!>NI<!>? = null val di: D.<!UNRESOLVED_REFERENCE!>NI<!>? = null
val kc: K.<!UNRESOLVED_REFERENCE!>NC<!> = K.<!UNRESOLVED_REFERENCE!>NC<!>() val kc: K.<!UNRESOLVED_REFERENCE!>NC<!> = K.<!UNRESOLVED_REFERENCE!>NC<!>()
val kic: K.<!UNRESOLVED_REFERENCE!>IC<!> = K().<!UNRESOLVED_REFERENCE!>IC<!>() val kic: K.<!UNRESOLVED_REFERENCE!>IC<!> = K().IC()
val ki: K.<!UNRESOLVED_REFERENCE!>NI<!>? = null val ki: K.<!UNRESOLVED_REFERENCE!>NI<!>? = null
} }
@@ -32,13 +32,13 @@ fun test() {
val ii: I.NI? = null val ii: I.NI? = null
val bc: B.<!UNRESOLVED_REFERENCE!>NC<!> = B.<!UNRESOLVED_REFERENCE!>NC<!>() val bc: B.<!UNRESOLVED_REFERENCE!>NC<!> = B.<!UNRESOLVED_REFERENCE!>NC<!>()
val bic: B.<!UNRESOLVED_REFERENCE!>IC<!> = B().<!UNRESOLVED_REFERENCE!>IC<!>() val bic: B.<!UNRESOLVED_REFERENCE!>IC<!> = B().IC()
val bi: B.<!UNRESOLVED_REFERENCE!>NI<!>? = null val bi: B.<!UNRESOLVED_REFERENCE!>NI<!>? = null
val cc: C.<!UNRESOLVED_REFERENCE!>NC<!> = C.<!UNRESOLVED_REFERENCE!>NC<!>() val cc: C.<!UNRESOLVED_REFERENCE!>NC<!> = C.<!UNRESOLVED_REFERENCE!>NC<!>()
val ci: C.<!UNRESOLVED_REFERENCE!>NI<!>? = null val ci: C.<!UNRESOLVED_REFERENCE!>NI<!>? = null
val dc: D.<!UNRESOLVED_REFERENCE!>NC<!> = D.<!UNRESOLVED_REFERENCE!>NC<!>() val dc: D.<!UNRESOLVED_REFERENCE!>NC<!> = D.<!UNRESOLVED_REFERENCE!>NC<!>()
val dic: D.<!UNRESOLVED_REFERENCE!>IC<!> = D().<!UNRESOLVED_REFERENCE!>IC<!>() val dic: D.<!UNRESOLVED_REFERENCE!>IC<!> = D().IC()
val di: D.<!UNRESOLVED_REFERENCE!>NI<!>? = null val di: D.<!UNRESOLVED_REFERENCE!>NI<!>? = null
} }
+1 -1
View File
@@ -23,6 +23,6 @@ class Outer {
fun Outer.foo() { fun Outer.foo() {
Outer() Outer()
<!NESTED_CLASS_SHOULD_BE_QUALIFIED!>Nested<!>() <!UNRESOLVED_REFERENCE!>Nested<!>()
Inner() Inner()
} }
@@ -24,30 +24,30 @@ object Obj {
} }
fun test(with: WithClassObject, without: WithoutClassObject, obj: Obj) { fun test(with: WithClassObject, without: WithoutClassObject, obj: Obj) {
with.<!NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE!>Nested<!>() with.<!UNRESOLVED_REFERENCE!>Nested<!>()
with.<!NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE!>NestedWithClassObject<!> with.<!NO_COMPANION_OBJECT, NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE!>NestedWithClassObject<!>
with.<!NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE!>NestedWithClassObject<!>() with.<!UNRESOLVED_REFERENCE!>NestedWithClassObject<!>()
with.<!NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE!>NestedWithClassObject<!>.foo() with.<!NO_COMPANION_OBJECT, NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE!>NestedWithClassObject<!>.foo()
with.<!NO_COMPANION_OBJECT, NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE!>NestedEnum<!>.A with.<!NO_COMPANION_OBJECT, NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE!>NestedEnum<!>.A
with.<!NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE!>NestedObj<!> with.<!NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE!>NestedObj<!>
with.<!NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE!>NestedObj<!>() with.<!UNRESOLVED_REFERENCE!>NestedObj<!>()
with.<!NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE!>NestedObj<!>.foo() with.<!NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE!>NestedObj<!>.foo()
without.<!NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE!>Nested<!>() without.<!UNRESOLVED_REFERENCE!>Nested<!>()
without.<!NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE!>NestedWithClassObject<!> without.<!NO_COMPANION_OBJECT, NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE!>NestedWithClassObject<!>
without.<!NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE!>NestedWithClassObject<!>() without.<!UNRESOLVED_REFERENCE!>NestedWithClassObject<!>()
without.<!NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE!>NestedWithClassObject<!>.foo() without.<!NO_COMPANION_OBJECT, NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE!>NestedWithClassObject<!>.foo()
without.<!NO_COMPANION_OBJECT, NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE!>NestedEnum<!>.A without.<!NO_COMPANION_OBJECT, NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE!>NestedEnum<!>.A
without.<!NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE!>NestedObj<!> without.<!NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE!>NestedObj<!>
without.<!NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE!>NestedObj<!>() without.<!UNRESOLVED_REFERENCE!>NestedObj<!>()
without.<!NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE!>NestedObj<!>.foo() without.<!NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE!>NestedObj<!>.foo()
obj.<!NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE!>Nested<!>() obj.<!UNRESOLVED_REFERENCE!>Nested<!>()
obj.<!NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE!>NestedWithClassObject<!> obj.<!NO_COMPANION_OBJECT, NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE!>NestedWithClassObject<!>
obj.<!NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE!>NestedWithClassObject<!>() obj.<!UNRESOLVED_REFERENCE!>NestedWithClassObject<!>()
obj.<!NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE!>NestedWithClassObject<!>.foo() obj.<!NO_COMPANION_OBJECT, NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE!>NestedWithClassObject<!>.foo()
obj.<!NO_COMPANION_OBJECT, NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE!>NestedEnum<!>.A obj.<!NO_COMPANION_OBJECT, NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE!>NestedEnum<!>.A
obj.<!NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE!>NestedObj<!> obj.<!NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE!>NestedObj<!>
obj.<!NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE!>NestedObj<!>() obj.<!UNRESOLVED_REFERENCE!>NestedObj<!>()
obj.<!NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE!>NestedObj<!>.foo() obj.<!NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE!>NestedObj<!>.foo()
} }
@@ -26,11 +26,11 @@ fun a() {
consumeString(a plus b) consumeString(a plus b)
consumeInt(a minus b) consumeInt(a minus b)
a <!OVERLOAD_RESOLUTION_AMBIGUITY!>*<!> b a * b
a <!OVERLOAD_RESOLUTION_AMBIGUITY!>/<!> b a <!OPERATOR_MODIFIER_REQUIRED!>/<!> b
a <!OVERLOAD_RESOLUTION_AMBIGUITY!>times<!> b a times b
a <!OVERLOAD_RESOLUTION_AMBIGUITY!>div<!> b a <!INFIX_MODIFIER_REQUIRED!>div<!> b
} }
} }
} }
@@ -24,7 +24,7 @@ operator fun Example.inc() = Example2()
infix fun Example.plus(o: Example) = "" infix fun Example.plus(o: Example) = ""
fun a() { fun test() {
var a = Example() var a = Example()
val b = Example() val b = Example()
@@ -1,9 +1,9 @@
package package
public fun a(): kotlin.Unit
public fun consumeExample2(/*0*/ e: Example2): kotlin.Unit public fun consumeExample2(/*0*/ e: Example2): kotlin.Unit
public fun consumeInt(/*0*/ i: kotlin.Int): kotlin.Unit public fun consumeInt(/*0*/ i: kotlin.Int): kotlin.Unit
public fun consumeString(/*0*/ s: kotlin.String): kotlin.Unit public fun consumeString(/*0*/ s: kotlin.String): kotlin.Unit
public fun test(): kotlin.Unit
public operator fun Example.component1(): kotlin.String public operator fun Example.component1(): kotlin.String
public operator fun Example.component2(): kotlin.String public operator fun Example.component2(): kotlin.String
public operator fun Example.get(/*0*/ i: kotlin.Int): kotlin.String public operator fun Example.get(/*0*/ i: kotlin.Int): kotlin.String
@@ -31,6 +31,6 @@ import p.*
fun B.test() { fun B.test() {
if (this is C) { if (this is C) {
"".getParent() "".<!DEBUG_INFO_IMPLICIT_RECEIVER_SMARTCAST!>getParent<!>()
} }
} }
@@ -24,10 +24,12 @@ class C
fun foo(i: Int?) : C = null!! fun foo(i: Int?) : C = null!!
fun test(i: Int, ni: Int?) { fun test(i: Int, ni: Int?) {
checkSubtype<J.A>(foo(2)) checkSubtype<C>(foo(2))
checkSubtype<J.A>(foo(i)) checkSubtype<J.A>(J.foo(2))
checkSubtype<J.A>(J.foo(i))
checkSubtype<J.B>(J.foo(ni))
checkSubtype<C>(foo(ni))
checkSubtype<J.B>(J.foo(ni)) checkSubtype<J.B>(J.foo(ni))
<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo<!>(ni)
foo(J.getInteger()) foo(J.getInteger())
J.foo(J.getInteger()) J.foo(J.getInteger())
@@ -5,7 +5,7 @@ fun test1(f: String.() -> Unit) {
} }
fun test2(f: (Int) -> Int) { fun test2(f: (Int) -> Int) {
1.<!INVOKE_EXTENSION_ON_NOT_EXTENSION_FUNCTION!>f<!>(<!TOO_MANY_ARGUMENTS!>2<!>) 1.<!UNRESOLVED_REFERENCE!>f<!>(2)
2.<!INVOKE_EXTENSION_ON_NOT_EXTENSION_FUNCTION!>(f)<!>(<!TOO_MANY_ARGUMENTS!>2<!>) 2.<!NO_RECEIVER_ALLOWED!>(f)<!>(2)
} }
@@ -3,8 +3,8 @@ interface Foo {
operator fun A.invoke() operator fun A.invoke()
} }
fun test(a: A, foo: Foo) { fun test(a: A, <!UNUSED_PARAMETER!>foo<!>: Foo) {
a.<!INVOKE_EXTENSION_ON_NOT_EXTENSION_FUNCTION!>foo<!>() a.<!UNRESOLVED_REFERENCE!>foo<!>()
} }
fun test(a: Int, foo: Int.()->Unit) { fun test(a: Int, foo: Int.()->Unit) {
@@ -12,7 +12,7 @@ fun test(a: A, b: B) {
a.foo(b) a.foo(b)
with(a) { with(a) {
b.<!MISSING_RECEIVER!>foo<!>() // todo b.foo()
b.(foo)() b.(foo)()
@@ -23,7 +23,7 @@ fun test(a: A, b: B) {
} }
with(b) { with(b) {
a.<!INVOKE_ON_EXTENSION_FUNCTION_WITH_EXPLICIT_DISPATCH_RECEIVER!>foo<!>() a.foo(<!NO_VALUE_FOR_PARAMETER!>)<!>
a.<!FUNCTION_EXPECTED!>(<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>foo<!>)<!>() a.<!FUNCTION_EXPECTED!>(<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>foo<!>)<!>()
(a.foo)() (a.foo)()
@@ -68,7 +68,7 @@ fun test(a: A, b: B) {
} }
with(b) { with(b) {
a.<!INVOKE_ON_EXTENSION_FUNCTION_WITH_EXPLICIT_DISPATCH_RECEIVER!>foo<!>() a.foo(<!NO_VALUE_FOR_PARAMETER!>)<!>
a.<!FUNCTION_EXPECTED!>(<!UNRESOLVED_REFERENCE!>foo<!>)<!>() a.<!FUNCTION_EXPECTED!>(<!UNRESOLVED_REFERENCE!>foo<!>)<!>()
(a.foo)() (a.foo)()
@@ -6,7 +6,7 @@ class B
fun test(a: A, b: B) { fun test(a: A, b: B) {
with(b) { with(b) {
a.<!INVOKE_ON_EXTENSION_FUNCTION_WITH_EXPLICIT_DISPATCH_RECEIVER!>foo<!>() // here must be error, because a is not extension receiver a.foo(<!NO_VALUE_FOR_PARAMETER!>)<!> // here must be error, because a is not extension receiver
a.foo(this) a.foo(this)
@@ -9,11 +9,11 @@ val B.a: () -> Int get() = { 5 }
fun test(a: A, b: B) { fun test(a: A, b: B) {
val <!UNUSED_VARIABLE!>x<!>: Int = b.a() val <!UNUSED_VARIABLE!>x<!>: Int = b.a()
b.<!INVOKE_EXTENSION_ON_NOT_EXTENSION_FUNCTION!>(a)<!>() b.<!FUNCTION_EXPECTED!>(a)<!>()
with(b) { with(b) {
val <!UNUSED_VARIABLE!>y<!>: Int = a() val <!UNUSED_VARIABLE!>y<!>: Int = a()
<!MISSING_RECEIVER!>(a)<!>() <!FUNCTION_EXPECTED!>(a)<!>()
} }
} }
@@ -1,5 +1,5 @@
// FILE: root.kt // FILE: root.kt
fun testFun() = 12 fun testFun() = "239"
// FILE: otherPackage.kt // FILE: otherPackage.kt
package test package test
@@ -9,4 +9,4 @@ fun testFun() = 12
// FILE: using.kt // FILE: using.kt
import test.* import test.*
val t = <!OVERLOAD_RESOLUTION_AMBIGUITY!>testFun<!>() val t: String = testFun()
@@ -1,7 +1,7 @@
package package
public val t: [ERROR : Type for testFun()] public val t: kotlin.String
public fun testFun(): kotlin.Int public fun testFun(): kotlin.String
package test { package test {
public fun testFun(): kotlin.Int public fun testFun(): kotlin.Int
@@ -15,12 +15,12 @@ class A<T> {
inner class I { inner class I {
init { init {
<!NESTED_CLASS_SHOULD_BE_QUALIFIED!>T<!>() // todo: fix error message T() // todo: https://jetbrains.quip.com/hPM5AJcc1nca
} }
} }
init { init {
<!NESTED_CLASS_SHOULD_BE_QUALIFIED!>T<!>() T()
} }
} }
@@ -47,11 +47,11 @@ class B<T> {
inner class I { inner class I {
init { init {
<!NESTED_CLASS_SHOULD_BE_QUALIFIED!>T<!>() T()
} }
} }
init { init {
<!NESTED_CLASS_SHOULD_BE_QUALIFIED!>T<!>() T()
} }
} }
@@ -33,8 +33,8 @@ class E: A() {
object Z { object Z {
init { init {
<!NESTED_CLASS_SHOULD_BE_QUALIFIED!>B<!>().<!UNRESOLVED_REFERENCE!>foo<!>() // todo: some resolve hacks <!UNRESOLVED_REFERENCE!>B<!>().<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>foo<!>()
<!NESTED_CLASS_SHOULD_BE_QUALIFIED!>B<!>().bar() <!UNRESOLVED_REFERENCE!>B<!>().<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>bar<!>()
<!UNRESOLVED_REFERENCE!>D<!>() <!UNRESOLVED_REFERENCE!>D<!>()
C() C()
@@ -31,6 +31,6 @@ public class X extends B {
// FILE: 2.kt // FILE: 2.kt
class Y: X() { class Y: X() {
init { init {
val a: Double = <!TYPE_MISMATCH!>foo()<!> // todo val a: Double = foo()
} }
} }
@@ -13,5 +13,5 @@ class A {
} }
constructor(x: Int) constructor(x: Int)
constructor() : this(foo() + prop + B.bar() + B.prop + C) constructor() : this(foo() + prop + B.bar() + B.prop <!NONE_APPLICABLE!>+<!> C)
} }
@@ -3,11 +3,15 @@ package foo
fun <T> f(<!UNUSED_PARAMETER!>l<!>: List<T>) {} fun <T> f(<!UNUSED_PARAMETER!>l<!>: List<T>) {}
// FILE: bar.kt
package bar
fun <T> f(<!UNUSED_PARAMETER!>l<!>: List<T>) {}
// FILE: main.kt // FILE: main.kt
import foo.* import foo.*
import bar.*
fun <T> f(<!UNUSED_PARAMETER!>l<!>: List<T>) {}
fun <T> test(l: List<T>) { fun <T> test(l: List<T>) {
<!CANNOT_COMPLETE_RESOLVE!>f<!>(l) <!CANNOT_COMPLETE_RESOLVE!>f<!>(l)
@@ -1,8 +1,11 @@
package package
public fun </*0*/ T> f(/*0*/ l: kotlin.List<T>): kotlin.Unit
public fun </*0*/ T> test(/*0*/ l: kotlin.List<T>): kotlin.Unit public fun </*0*/ T> test(/*0*/ l: kotlin.List<T>): kotlin.Unit
package bar {
public fun </*0*/ T> f(/*0*/ l: kotlin.List<T>): kotlin.Unit
}
package foo { package foo {
public fun </*0*/ T> f(/*0*/ l: kotlin.List<T>): kotlin.Unit public fun </*0*/ T> f(/*0*/ l: kotlin.List<T>): kotlin.Unit
} }
@@ -47,7 +47,7 @@ fun test(d: dynamic) {
val plus: dynamic = null val plus: dynamic = null
} }
C() <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>+<!> 5 C() + 5 // todo should be marked as DEBUG_INFO_DYNAMIC
C().<!DEBUG_INFO_DYNAMIC!>plus(5)<!> C().<!DEBUG_INFO_DYNAMIC!>plus(5)<!>
d == d d == d
@@ -27,7 +27,7 @@ fun dynamic.test() {
<!DEBUG_INFO_DYNAMIC!>this<!>() <!DEBUG_INFO_DYNAMIC!>this<!>()
C() + C() C() + C()
<!DEPRECATED_UNARY_PLUS_MINUS!><!NO_VALUE_FOR_PARAMETER!>+<!>C()<!> <!UNRESOLVED_REFERENCE!>+<!>C()
this <!DEBUG_INFO_DYNAMIC!>+<!> C() this <!DEBUG_INFO_DYNAMIC!>+<!> C()
@@ -8,15 +8,15 @@ fun <T : Any> T?.sure() : T = this!!
fun <E> List<*>.toArray(ar: Array<E>): Array<E> = ar fun <E> List<*>.toArray(ar: Array<E>): Array<E> = ar
fun testArrays(ci: List<Int?>, cii: List<Int?>?) { fun testArrays(ci: List<Int?>, cii: List<Int?>?) {
val c1: Array<Int?> = cii.sure().toArray(<!FUNCTION_CALL_EXPECTED!><!NO_VALUE_FOR_PARAMETER, NO_VALUE_FOR_PARAMETER!>Array<!><Int?><!>) val c1: Array<Int?> = cii.sure().toArray(<!FUNCTION_CALL_EXPECTED!><!INVISIBLE_MEMBER!>Array<!><Int?><!>)
val c2: Array<Int?> = ci.toArray(Array<Int?>(<!NO_VALUE_FOR_PARAMETER, NO_VALUE_FOR_PARAMETER!>)<!>) val c2: Array<Int?> = ci.toArray(<!INVISIBLE_MEMBER!>Array<!><Int?>())
val c3 = Array<Int?>(<!NO_VALUE_FOR_PARAMETER, NO_VALUE_FOR_PARAMETER!>)<!> val c3 = <!INVISIBLE_MEMBER!>Array<!><Int?>()
val c4 = ci.toArray<Int?>(Array<Int?>(<!NO_VALUE_FOR_PARAMETER, NO_VALUE_FOR_PARAMETER!>)<!>) val c4 = ci.toArray<Int?>(<!INVISIBLE_MEMBER!>Array<!><Int?>())
val c5 = ci.toArray(Array<Int?>(<!NO_VALUE_FOR_PARAMETER, NO_VALUE_FOR_PARAMETER!>)<!>) val c5 = ci.toArray(<!INVISIBLE_MEMBER!>Array<!><Int?>())
checkSubtype<Array<Int?>>(c1) checkSubtype<Array<Int?>>(c1)
checkSubtype<Array<Int?>>(c2) checkSubtype<Array<Int?>>(c2)
@@ -76,8 +76,6 @@ fun <T> tt(t : T) : T {
`dec`--y `dec`--y
y`dec`-- y`dec`--
y `+=`+= 1 y `+=`+= 1
`+`+y
`-`-y
1 `kotlin::Int.compareTo(Double)`> 2.0 1 `kotlin::Int.compareTo(Double)`> 2.0
1 `kotlin::Int.compareTo(Double)`< 2.0 1 `kotlin::Int.compareTo(Double)`< 2.0
1 `kotlin::Int.compareTo(Double)`>= 2.0 1 `kotlin::Int.compareTo(Double)`>= 2.0
@@ -1,9 +1,9 @@
class A { class A {
fun B.foo() = 2 ~foo~fun B.foo() = 2
} }
class B { class B {
~A.foo~fun A.foo() = 1 ~A.foo~fun A.foo() = 1
fun A.bar() = `A.foo`foo() fun A.bar() = `foo`foo()
} }
@@ -1,7 +1,7 @@
class A class A
class B { class B {
fun foo() = 1 ~foo~fun foo() = 1
~A.foo~fun A.foo() = 2 ~A.foo~fun A.foo() = 2
fun A.bar() = `A.foo`foo() fun A.bar() = `foo`foo()
} }
@@ -1,9 +1,9 @@
class A class A
class B { class B {
fun foo() = 2 ~foo~fun foo() = 2
fun A.bar() = `A.foo`foo() fun A.bar() = `foo`foo()
} }
~A.foo~fun A.foo() = 1 ~A.foo~fun A.foo() = 1
@@ -1,5 +1,5 @@
class A { class A {
fun foo() = 1 ~A.foo~fun foo() = 1
} }
class B { class B {
} }
@@ -8,7 +8,7 @@ class B {
fun test(a: A, b: B) { fun test(a: A, b: B) {
with (a) { with (a) {
with (b) { with (b) {
`B.foo`foo() `A.foo`foo()
} }
} }
} }
@@ -1,6 +1,6 @@
fun ~A.foo~A.foo() = 1 ~A.foo~fun A.foo() = 1
fun foo() = 2 ~foo~fun foo() = 2
class A { class A {
fun test() = `A.foo`foo() fun test() = `foo`foo()
} }
@@ -1,11 +1,11 @@
class A { class A {
} }
~extension~fun A.foo() = 1 ~extension~fun A.foo() = 1
fun foo() = 2 ~simple~fun foo() = 2
fun test(a: A) { fun test(a: A) {
with (a) { with (a) {
`extension`foo() `simple`foo()
} }
} }
+1 -5
View File
@@ -1,7 +1,3 @@
class Foo() { fun bar(f: Int.() -> Unit) {
fun Int.invoke() {}
}
fun bar(f: Foo) {
1.f<caret>() 1.f<caret>()
} }
+3 -7
View File
@@ -1,8 +1,4 @@
class Foo() { fun bar(f: Int.() -> Unit) {
fun Int.invoke() {}
}
fun bar(f: Foo) {
1.f<caret>() 1.f<caret>()
} }
@@ -10,8 +6,8 @@ fun bar(f: Foo) {
Resolved call: Resolved call:
Resulting descriptor: fun Int.invoke(): Unit defined in Foo Resulting descriptor: operator fun Int.invoke(): Unit defined in kotlin.Function1
Explicit receiver kind = BOTH_RECEIVERS Explicit receiver kind = BOTH_RECEIVERS
Dispatch receiver = f {Foo} Dispatch receiver = f {[@kotlin.Extension] Function1<Int, Unit>}
Extension receiver = 1 {Int} Extension receiver = 1 {Int}
+7 -6
View File
@@ -1,10 +1,11 @@
object A { object A {
class B class B
fun foo() = 1 fun foo() = 1
object Bar{} object Bar {}
} }
fun <T> test(a: T) { fun <T> test(a: T) {
val c = (a as A) val c = (a as A)
c.<error descr="[NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE] Nested class 'B' accessed via instance reference">B</error>() // TODO: report "nested class accessed via instance reference"
} c.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: B">B</error>()
}
@@ -1,6 +1,3 @@
// ERROR: Overload resolution ambiguity: public fun a.A.ext(): kotlin.Unit defined in a public fun a.A.ext(): kotlin.Unit defined in to
// ERROR: Overload resolution ambiguity: public var a.A.p: kotlin.Int defined in a public var a.A.p: kotlin.Int defined in to
// ERROR: Overload resolution ambiguity: public var a.A.p: kotlin.Int defined in a public var a.A.p: kotlin.Int defined in to
package to package to
import a.A import a.A
@@ -1,8 +1,3 @@
// ERROR: Overload resolution ambiguity: public fun a.A.ext(): kotlin.Unit defined in a public fun a.A.ext(): kotlin.Unit defined in to
// ERROR: Overload resolution ambiguity: public operator fun a.A.plus(a: a.A): kotlin.Unit defined in a public operator fun a.A.plus(a: a.A): kotlin.Unit defined in to
// ERROR: Overload resolution ambiguity: public infix fun a.A.infix(a: a.A): kotlin.Unit defined in a public infix fun a.A.infix(a: a.A): kotlin.Unit defined in to
// ERROR: Overload resolution ambiguity: public operator fun a.A.unaryMinus(): kotlin.Unit defined in a public operator fun a.A.unaryMinus(): kotlin.Unit defined in to
// ERROR: Overload resolution ambiguity: public val a.A.p: kotlin.Int defined in a public val a.A.p: kotlin.Int defined in to
package to package to
import a.A import a.A
@@ -1,13 +1,13 @@
// ERROR: Nested class 'Nested' should be qualified as 'A.Nested'
package to package to
import a.A
import a.ext import a.ext
import a.f import a.f
fun g() { fun g() {
f { f {
Inner() Inner()
Nested() A.Nested()
foo() foo()
ext() ext()
} }
@@ -1,4 +1,4 @@
// !DIAGNOSTICS_NUMBER: 4 // !DIAGNOSTICS_NUMBER: 3
// !DIAGNOSTICS: NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE // !DIAGNOSTICS: NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE
class A { class A {
@@ -9,8 +9,8 @@ class A {
} }
fun test(a: A) { fun test(a: A) {
a.Nested()
a.NestedWithClassObject a.NestedWithClassObject
a.NestedEnum a.NestedEnum
a.NestedObj a.NestedObj
} a.Nested() // TODO: report "nested class accessed via instance reference" here as well
}
@@ -1,2 +1,2 @@
<!-- nestedClassAcessedViaInstanceReference1 --> <!-- nestedClassAcessedViaInstanceReference1 -->
Nested class 'Nested' accessed via instance reference Nested class 'NestedWithClassObject' accessed via instance reference
@@ -1,2 +1,2 @@
<!-- nestedClassAcessedViaInstanceReference2 --> <!-- nestedClassAcessedViaInstanceReference2 -->
Nested companion object 'Companion' accessed via instance reference Nested enum class 'NestedEnum' accessed via instance reference
@@ -1,2 +1,2 @@
<!-- nestedClassAcessedViaInstanceReference3 --> <!-- nestedClassAcessedViaInstanceReference3 -->
Nested enum class 'NestedEnum' accessed via instance reference Nested object 'NestedObj' accessed via instance reference
@@ -1,2 +1,2 @@
<!-- nestedClassAcessedViaInstanceReference4 --> <!-- nestedClassAcessedViaInstanceReference4 -->
Nested object 'NestedObj' accessed via instance reference Nested class 'Nested' accessed via instance reference
@@ -1,6 +1,8 @@
// !DIAGNOSTICS_NUMBER: 5 // !DIAGNOSTICS_NUMBER: 0
// !DIAGNOSTICS: NESTED_CLASS_SHOULD_BE_QUALIFIED // !DIAGNOSTICS: NESTED_CLASS_SHOULD_BE_QUALIFIED
// TODO: 5 "nested class should be qualified" dianostics should be reported here
package p package p
class A { class A {
@@ -2,5 +2,4 @@ Function call (10: 17) A(0) + A(1) + 2
Function call (11: 20) A(0) plus A(1) plus 2 Function call (11: 20) A(0) plus A(1) plus 2
Function call (12: 20) A(0).plus(A(1).plus(2)) Function call (12: 20) A(0).plus(A(1).plus(2))
Function call (15: 7) a += 1 Function call (15: 7) a += 1
Function call (6: 30) fun plus(a: A): A = this + a.n Function call (6: 30) fun plus(a: A): A = this + a.n
Unclassified usage (18: 5) +A(0)
+1 -1
View File
@@ -6,7 +6,7 @@ public fun String.infixMessage(@PropertyKey(resourceBundle = "idea.testData.find
public fun @receiver:PropertyKey(resourceBundle = "idea.testData.findUsages.propertyFiles.propertyUsages.0") String.infixMessage2(s: String) = this public fun @receiver:PropertyKey(resourceBundle = "idea.testData.findUsages.propertyFiles.propertyUsages.0") String.infixMessage2(s: String) = this
public fun @receiver:PropertyKey(resourceBundle = "idea.testData.findUsages.propertyFiles.propertyUsages.0") String.minus() = this public fun @receiver:PropertyKey(resourceBundle = "idea.testData.findUsages.propertyFiles.propertyUsages.0") String.unaryMinus() = this
public fun Int.get(@PropertyKey(resourceBundle = "idea.testData.findUsages.propertyFiles.propertyUsages.0") key: String) = this public fun Int.get(@PropertyKey(resourceBundle = "idea.testData.findUsages.propertyFiles.propertyUsages.0") key: String) = this
@@ -1,7 +1,5 @@
package a package a
import java.lang.AssertionError
fun foo() { fun foo() {
if (!true) { if (!true) {
throw AssertionError("text") throw AssertionError("text")
@@ -1,6 +1,6 @@
// PARAM_DESCRIPTOR: value-parameter val plus: kotlin.String.() -> kotlin.Unit defined in foo // PARAM_DESCRIPTOR: value-parameter val unaryPlus: kotlin.String.() -> kotlin.Unit defined in foo
// PARAM_TYPES: kotlin.String.() -> kotlin.Unit // PARAM_TYPES: kotlin.String.() -> kotlin.Unit
fun foo(plus: String.() -> Unit) { fun foo(unaryPlus: String.() -> Unit) {
<selection>+</selection> "A" <selection>+</selection> "A"
} }
@@ -1,8 +1,8 @@
// PARAM_DESCRIPTOR: value-parameter val plus: kotlin.String.() -> kotlin.Unit defined in foo // PARAM_DESCRIPTOR: value-parameter val unaryPlus: kotlin.String.() -> kotlin.Unit defined in foo
// PARAM_TYPES: kotlin.String.() -> kotlin.Unit // PARAM_TYPES: kotlin.String.() -> kotlin.Unit
fun foo(plus: String.() -> Unit) { fun foo(unaryPlus: String.() -> Unit) {
"A".(function(plus))() "A".(function(plus))()
} }
private fun function(plus: String.() -> Unit) = plus private fun function(unaryPlus: String.() -> Unit) = unaryPlus
+1 -1
View File
@@ -7,4 +7,4 @@ fun main(args : Array<String>) {
var a = <caret>IntArray(array(1, 2, 3)) var a = <caret>IntArray(array(1, 2, 3))
} }
// REF: (in kotlin.IntArray).IntArray(Int) // REF: (ctrl_click).IntArray(Int)
@@ -28,6 +28,7 @@ import com.intellij.refactoring.BaseRefactoringProcessor;
import com.intellij.util.PathUtil; import com.intellij.util.PathUtil;
import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.Convertor; import com.intellij.util.containers.Convertor;
import junit.framework.ComparisonFailure;
import kotlin.jvm.functions.Function0; import kotlin.jvm.functions.Function0;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.idea.test.ConfigLibraryUtil; import org.jetbrains.kotlin.idea.test.ConfigLibraryUtil;
@@ -39,7 +40,6 @@ import org.jetbrains.kotlin.psi.KtFile;
import org.jetbrains.kotlin.test.InTextDirectivesUtils; import org.jetbrains.kotlin.test.InTextDirectivesUtils;
import org.jetbrains.kotlin.test.KotlinTestUtils; import org.jetbrains.kotlin.test.KotlinTestUtils;
import org.junit.Assert; import org.junit.Assert;
import org.junit.ComparisonFailure;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
@@ -178,7 +178,7 @@ public abstract class AbstractIntentionTest extends KotlinCodeInsightTestCase {
checkResultByFile(canonicalPathToExpectedFile); checkResultByFile(canonicalPathToExpectedFile);
} }
catch (ComparisonFailure e) { catch (ComparisonFailure e) {
KotlinTestUtils.assertEqualsToFile(new File(canonicalPathToExpectedFile), getEditor()); KotlinTestUtils.assertEqualsToFile(new File(canonicalPathToExpectedFile), getEditor().getDocument().getText());
} }
} }
} }