deprecating types after colon

This commit is contained in:
Dmitry Jemerov
2015-04-21 18:32:31 +02:00
parent b7a4b3c17d
commit f374eec8f1
268 changed files with 1055 additions and 769 deletions
@@ -1,9 +1,9 @@
// !DIAGNOSTICS: -UNUSED_EXPRESSION
// !DIAGNOSTICS: -UNUSED_EXPRESSION,-UNUSED_VARIABLE
fun foo(x: Int, <!UNUSED_PARAMETER!>y<!>: Any) = x
fun foo(<!UNUSED_PARAMETER!>x<!>: Any, y: Int) = y
fun main() {
::<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo<!>
::<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo<!> : (Int, Any) -> Unit
}
val fooRef: (Int, Any) -> Unit = ::<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo<!>
}
@@ -1,10 +1,12 @@
// !CHECK_TYPE
import kotlin.reflect.KFunction0
class A {
fun main() {
val x = ::A
x : KFunction0<A>
checkSubtype<KFunction0<A>>(x)
}
}
@@ -12,6 +14,6 @@ class SomeOtherClass {
fun main() {
val x = ::A
x : KFunction0<A>
checkSubtype<KFunction0<A>>(x)
}
}
@@ -1,3 +1,5 @@
// !CHECK_TYPE
import kotlin.reflect.KFunction0
class A
@@ -7,6 +9,6 @@ fun A.ext() {
val x = ::A
val y = ::B
x : KFunction0<A>
y : KFunction0<B>
checkSubtype<KFunction0<A>>(x)
checkSubtype<KFunction0<B>>(y)
}
@@ -1,3 +1,5 @@
// !CHECK_TYPE
import kotlin.reflect.KFunction0
class A
@@ -7,15 +9,15 @@ class B {
val x = ::A
val y = ::B
x : KFunction0<A>
y : KFunction0<B>
checkSubtype<KFunction0<A>>(x)
checkSubtype<KFunction0<B>>(y)
}
fun B.ext() {
val x = ::A
val y = ::B
x : KFunction0<A>
y : KFunction0<B>
checkSubtype<KFunction0<A>>(x)
checkSubtype<KFunction0<B>>(y)
}
}
@@ -1,3 +1,5 @@
// !CHECK_TYPE
import kotlin.reflect.KFunction0
class A
@@ -5,5 +7,5 @@ class A
fun main() {
val x = ::A
x : KFunction0<A>
checkSubtype<KFunction0<A>>(x)
}
@@ -1,3 +1,4 @@
// !CHECK_TYPE
// FILE: a.kt
package first
@@ -21,7 +22,7 @@ fun main() {
val y = first.A::bar
val z = A::baz
x : KMemberFunction0<A, Unit>
y : KMemberFunction1<A, Int, Unit>
z : KMemberFunction0<A, String>
checkSubtype<KMemberFunction0<A, Unit>>(x)
checkSubtype<KMemberFunction1<A, Int, Unit>>(y)
checkSubtype<KMemberFunction0<A, String>>(z)
}
@@ -1,3 +1,4 @@
// !CHECK_TYPE
// !DIAGNOSTICS: -UNUSED_EXPRESSION
// FILE: a.kt
@@ -23,5 +24,5 @@ fun main() {
first.A::<!UNRESOLVED_REFERENCE!>bar<!>
A::<!UNRESOLVED_REFERENCE!>baz<!>
x : KExtensionFunction0<A, Unit>
checkSubtype<KExtensionFunction0<A, Unit>>(x)
}
@@ -1,3 +1,4 @@
// !CHECK_TYPE
// FILE: a.kt
package first
@@ -21,7 +22,7 @@ fun main() {
val y = ::bar
val z = ::baz
x : KFunction0<Unit>
y : KFunction1<Int, Unit>
z : KFunction0<String>
checkSubtype<KFunction0<Unit>>(x)
checkSubtype<KFunction1<Int, Unit>>(y)
checkSubtype<KFunction0<String>>(z)
}
@@ -1,3 +1,5 @@
// !CHECK_TYPE
import kotlin.reflect.*
class A {
@@ -6,9 +8,9 @@ class A {
val y = ::bar
val z = ::baz
x : KExtensionFunction0<A, Unit>
y : KExtensionFunction1<A, Int, Unit>
z : KExtensionFunction0<A, String>
checkSubtype<KExtensionFunction0<A, Unit>>(x)
checkSubtype<KExtensionFunction1<A, Int, Unit>>(y)
checkSubtype<KExtensionFunction0<A, String>>(z)
}
}
@@ -1,3 +1,5 @@
// !CHECK_TYPE
import kotlin.reflect.*
class A
@@ -7,9 +9,9 @@ fun A.main() {
val y = ::bar
val z = ::baz
x : KExtensionFunction0<A, Unit>
y : KExtensionFunction1<A, Int, Unit>
z : KExtensionFunction0<A, String>
checkSubtype<KExtensionFunction0<A, Unit>>(x)
checkSubtype<KExtensionFunction1<A, Int, Unit>>(y)
checkSubtype<KExtensionFunction0<A, String>>(z)
}
fun A.foo() {}
@@ -1,3 +1,5 @@
// !CHECK_TYPE
import kotlin.reflect.*
class B
@@ -8,9 +10,9 @@ class A {
val y = ::bar
val z = ::baz
x : KExtensionFunction0<A, Unit>
y : KExtensionFunction1<A, Int, Unit>
z : KExtensionFunction0<A, String>
checkSubtype<KExtensionFunction0<A, Unit>>(x)
checkSubtype<KExtensionFunction1<A, Int, Unit>>(y)
checkSubtype<KExtensionFunction0<A, String>>(z)
}
}
@@ -1,3 +1,5 @@
// !CHECK_TYPE
import kotlin.reflect.*
class A
@@ -11,7 +13,7 @@ fun main() {
val y = A::bar
val z = A::baz
x : KExtensionFunction0<A, Unit>
y : KExtensionFunction1<A, Int, Unit>
z : KExtensionFunction0<A, String>
checkSubtype<KExtensionFunction0<A, Unit>>(x)
checkSubtype<KExtensionFunction1<A, Int, Unit>>(y)
checkSubtype<KExtensionFunction0<A, String>>(z)
}
@@ -1,3 +1,5 @@
// !DIAGNOSTICS:-UNUSED_VARIABLE
import kotlin.reflect.*
class A {
@@ -6,5 +8,5 @@ class A {
fun A?.foo() {}
val f = A::foo : KMemberFunction0<A, Unit>
val g = A?::foo : KExtensionFunction0<A, Unit>
val f: KMemberFunction0<A, Unit> = A::foo
val g: KExtensionFunction0<A, Unit> = A?::foo
@@ -1,3 +1,5 @@
// !CHECK_TYPE
import kotlin.reflect.KMemberFunction0
class A<T>(val t: T) {
@@ -7,5 +9,5 @@ class A<T>(val t: T) {
fun bar() {
val x = A<String>::foo
x : KMemberFunction0<A<String>, String>
checkSubtype<KMemberFunction0<A<String>, String>>(x)
}
@@ -1,3 +1,4 @@
// !CHECK_TYPE
// !DIAGNOSTICS: -UNUSED_EXPRESSION
import kotlin.reflect.KMemberFunction0
@@ -8,8 +9,8 @@ class A {
val x = ::Inner
val y = A::Inner
x : KMemberFunction0<A, A.Inner>
y : KMemberFunction0<A, Inner>
checkSubtype<KMemberFunction0<A, A.Inner>>(x)
checkSubtype<KMemberFunction0<A, Inner>>(y)
}
companion object {
@@ -17,7 +18,7 @@ class A {
::<!INACCESSIBLE_OUTER_CLASS_EXPRESSION!>Inner<!>
val y = A::Inner
y : KMemberFunction0<A, A.Inner>
checkSubtype<KMemberFunction0<A, A.Inner>>(y)
}
}
}
@@ -27,6 +28,6 @@ class B {
::<!UNRESOLVED_REFERENCE!>Inner<!>
val y = A::Inner
y : KMemberFunction0<A, A.Inner>
checkSubtype<KMemberFunction0<A, A.Inner>>(y)
}
}
@@ -1,3 +1,4 @@
// !CHECK_TYPE
// !DIAGNOSTICS: -UNUSED_EXPRESSION
import kotlin.reflect.KMemberFunction0
@@ -9,13 +10,13 @@ fun A.main() {
val x = ::Inner
val y = A::Inner
x : KMemberFunction0<A, A.Inner>
y : KMemberFunction0<A, A.Inner>
checkSubtype<KMemberFunction0<A, A.Inner>>(x)
checkSubtype<KMemberFunction0<A, A.Inner>>(y)
}
fun Int.main() {
::<!UNRESOLVED_REFERENCE!>Inner<!>
val y = A::Inner
y : KMemberFunction0<A, A.Inner>
checkSubtype<KMemberFunction0<A, A.Inner>>(y)
}
@@ -1,3 +1,4 @@
// !CHECK_TYPE
// !DIAGNOSTICS: -UNUSED_EXPRESSION
import kotlin.reflect.KMemberFunction0
@@ -9,5 +10,5 @@ fun main() {
::<!UNRESOLVED_REFERENCE!>Inner<!>
val y = A::Inner
y : KMemberFunction0<A, A.Inner>
checkSubtype<KMemberFunction0<A, A.Inner>>(y)
}
@@ -1,3 +1,4 @@
// !CHECK_TYPE
// FILE: test/A.java
package test
@@ -17,7 +18,7 @@ import test.A
fun foo(args: Array<String>) {
val main2 = A::main
main2 : KFunction1<Array<String>, Unit>
checkSubtype<KFunction1<Array<String>, Unit>>(main2)
main2(args)
(A::main)(args)
}
@@ -1,8 +1,10 @@
// !CHECK_TYPE
import kotlin.reflect.KFunction0
fun main() {
class A
val x = ::A
x : KFunction0<A>
checkSubtype<KFunction0<A>>(x)
}
@@ -1,3 +1,5 @@
// !CHECK_TYPE
import kotlin.reflect.KFunction0
fun main() {
@@ -6,11 +8,11 @@ fun main() {
class B {
fun Int.foo() {
val x = ::A
x : KFunction0<A>
checkSubtype<KFunction0<A>>(x)
}
fun A.foo() {
val x = ::A
x : KFunction0<A>
checkSubtype<KFunction0<A>>(x)
}
}
}
@@ -1,3 +1,5 @@
// !CHECK_TYPE
import kotlin.reflect.KFunction0
fun main() {
@@ -5,11 +7,11 @@ fun main() {
fun A.foo() {
val x = ::A
x : KFunction0<A>
checkSubtype<KFunction0<A>>(x)
}
fun Int.foo() {
val x = ::A
x : KFunction0<A>
checkSubtype<KFunction0<A>>(x)
}
}
@@ -1,3 +1,5 @@
// !CHECK_TYPE
import kotlin.reflect.*
fun main() {
@@ -9,7 +11,7 @@ fun main() {
val y = ::bar
val z = ::baz
x : KFunction0<Unit>
y : KFunction1<Int, Unit>
z : KFunction0<String>
checkSubtype<KFunction0<Unit>>(x)
checkSubtype<KFunction1<Int, Unit>>(y)
checkSubtype<KFunction0<String>>(z)
}
@@ -1,3 +1,5 @@
// !CHECK_TYPE
import kotlin.reflect.*
class A
@@ -13,9 +15,9 @@ fun main() {
val y = ::bar
val z = ::baz
x : KFunction0<Unit>
y : KFunction1<Int, Unit>
z : KFunction0<String>
checkSubtype<KFunction0<Unit>>(x)
checkSubtype<KFunction1<Int, Unit>>(y)
checkSubtype<KFunction0<String>>(z)
}
}
}
@@ -1,3 +1,5 @@
// !CHECK_TYPE
import kotlin.reflect.*
fun main() {
@@ -11,9 +13,9 @@ fun main() {
val z = ::baz
fun main() {
x : KFunction0<Unit>
y : KFunction1<Int, Unit>
z : KFunction0<String>
checkSubtype<KFunction0<Unit>>(x)
checkSubtype<KFunction1<Int, Unit>>(y)
checkSubtype<KFunction0<String>>(z)
}
}
}
@@ -1,3 +1,5 @@
// !CHECK_TYPE
import kotlin.reflect.*
class A
@@ -12,8 +14,8 @@ fun main() {
val y = ::bar
val z = ::baz
x : KFunction0<Unit>
y : KFunction1<Int, Unit>
z : KFunction0<String>
checkSubtype<KFunction0<Unit>>(x)
checkSubtype<KFunction1<Int, Unit>>(y)
checkSubtype<KFunction0<String>>(z)
}
}
@@ -1,3 +1,4 @@
// !CHECK_TYPE
// FILE: a.kt
package a.b.c
@@ -13,5 +14,5 @@ import kotlin.reflect.KMemberFunction0
fun main() {
val x = a.b.c.D::foo
x : KMemberFunction0<a.b.c.D, Int>
checkSubtype<KMemberFunction0<a.b.c.D, Int>>(x)
}
@@ -1,3 +1,4 @@
// !CHECK_TYPE
// FILE: a.kt
package a.b.c
@@ -13,5 +14,5 @@ import kotlin.reflect.KMemberFunction2
fun main() {
val x = a.b.c.D<String, Int>::foo
x : KMemberFunction2<a.b.c.D<String, Int>, String, Int, a.b.c.D<String, Int>>
checkSubtype<KMemberFunction2<a.b.c.D<String, Int>, String, Int, a.b.c.D<String, Int>>>(x)
}
@@ -1,3 +1,5 @@
// !CHECK_TYPE
import kotlin.reflect.*
class A {
@@ -10,8 +12,8 @@ class A {
val y = ::bar
val z = ::baz
x : KMemberFunction0<A, Unit>
y : KMemberFunction1<A, Int, Unit>
z : KMemberFunction0<A, String>
checkSubtype<KMemberFunction0<A, Unit>>(x)
checkSubtype<KMemberFunction1<A, Int, Unit>>(y)
checkSubtype<KMemberFunction0<A, String>>(z)
}
}
@@ -1,3 +1,5 @@
// !CHECK_TYPE
import kotlin.reflect.*
class A {
@@ -11,7 +13,7 @@ fun A.main() {
val y = ::bar
val z = ::baz
x : KMemberFunction0<A, Unit>
y : KMemberFunction1<A, Int, Unit>
z : KMemberFunction0<A, String>
checkSubtype<KMemberFunction0<A, Unit>>(x)
checkSubtype<KMemberFunction1<A, Int, Unit>>(y)
checkSubtype<KMemberFunction0<A, String>>(z)
}
@@ -1,3 +1,5 @@
// !CHECK_TYPE
import kotlin.reflect.*
class A {
@@ -12,8 +14,8 @@ class B {
val y = ::bar
val z = ::baz
x : KMemberFunction0<A, Unit>
y : KMemberFunction1<A, Int, Unit>
z : KMemberFunction0<A, String>
checkSubtype<KMemberFunction0<A, Unit>>(x)
checkSubtype<KMemberFunction1<A, Int, Unit>>(y)
checkSubtype<KMemberFunction0<A, String>>(z)
}
}
@@ -1,3 +1,5 @@
// !CHECK_TYPE
import kotlin.reflect.*
class A {
@@ -11,7 +13,7 @@ fun main() {
val y = A::bar
val z = A::baz
x : KMemberFunction0<A, Unit>
y : KMemberFunction1<A, Int, Unit>
z : KMemberFunction0<A, String>
checkSubtype<KMemberFunction0<A, Unit>>(x)
checkSubtype<KMemberFunction1<A, Int, Unit>>(y)
checkSubtype<KMemberFunction0<A, String>>(z)
}
@@ -1,3 +1,4 @@
// !CHECK_TYPE
// !DIAGNOSTICS: -UNUSED_EXPRESSION
import kotlin.reflect.KFunction0
@@ -8,8 +9,8 @@ class A {
val x = ::Nested
val y = A::Nested
x : KFunction0<Nested>
y : KFunction0<Nested>
checkSubtype<KFunction0<Nested>>(x)
checkSubtype<KFunction0<Nested>>(y)
}
companion object {
@@ -17,7 +18,7 @@ class A {
::Nested
val y = A::Nested
y : KFunction0<A.Nested>
checkSubtype<KFunction0<A.Nested>>(y)
}
}
}
@@ -27,6 +28,6 @@ class B {
::<!UNRESOLVED_REFERENCE!>Nested<!>
val y = A::Nested
y : KFunction0<A.Nested>
checkSubtype<KFunction0<A.Nested>>(y)
}
}
@@ -1,3 +1,4 @@
// !CHECK_TYPE
// !DIAGNOSTICS: -UNUSED_EXPRESSION
import kotlin.reflect.KFunction0
@@ -9,12 +10,12 @@ fun A.main() {
::<!NESTED_CLASS_SHOULD_BE_QUALIFIED!>Nested<!>
val y = A::Nested
y : KFunction0<A.Nested>
checkSubtype<KFunction0<A.Nested>>(y)
}
fun Int.main() {
::<!UNRESOLVED_REFERENCE!>Nested<!>
val y = A::Nested
y : KFunction0<A.Nested>
checkSubtype<KFunction0<A.Nested>>(y)
}
@@ -1,3 +1,5 @@
// !CHECK_TYPE
import kotlin.reflect.KFunction0
class A {
@@ -7,5 +9,5 @@ class A {
fun main() {
val x = A::Nested
x : KFunction0<A.Nested>
checkSubtype<KFunction0<A.Nested>>(x)
}
@@ -1,3 +1,5 @@
// !CHECK_TYPE
import kotlin.reflect.KMemberFunction0
class A {
@@ -9,5 +11,5 @@ fun A.foo() {}
fun main() {
val x = A::foo
x : KMemberFunction0<A, Int>
checkSubtype<KMemberFunction0<A, Int>>(x)
}
@@ -1,3 +1,5 @@
// !CHECK_TYPE
import kotlin.reflect.KMemberFunction0
fun foo() {}
@@ -8,6 +10,6 @@ class A {
fun main() {
val x = ::foo
x : KMemberFunction0<A, Unit>
checkSubtype<KMemberFunction0<A, Unit>>(x)
}
}
@@ -1,3 +1,4 @@
// !CHECK_TYPE
// FILE: a.kt
package other
@@ -23,7 +24,7 @@ fun main() {
val y = AA::bar
val z = AA::bazbaz
x : KFunction0<Unit>
y : KMemberFunction0<AA, Int>
z : KExtensionFunction1<AA, String, Unit>
checkSubtype<KFunction0<Unit>>(x)
checkSubtype<KMemberFunction0<AA, Int>>(y)
checkSubtype<KExtensionFunction1<AA, String, Unit>>(z)
}
@@ -1,3 +1,5 @@
// !CHECK_TYPE
import kotlin.reflect.*
fun foo() {}
@@ -10,8 +12,8 @@ class A {
val y = ::bar
val z = ::baz
x : KFunction0<Unit>
y : KFunction1<Int, Unit>
z : KFunction0<String>
checkSubtype<KFunction0<Unit>>(x)
checkSubtype<KFunction1<Int, Unit>>(y)
checkSubtype<KFunction0<String>>(z)
}
}
@@ -1,3 +1,5 @@
// !CHECK_TYPE
import kotlin.reflect.*
class A
@@ -11,7 +13,7 @@ fun A.main() {
val y = ::bar
val z = ::baz
x : KFunction0<Unit>
y : KFunction1<Int, Unit>
z : KFunction0<String>
checkSubtype<KFunction0<Unit>>(x)
checkSubtype<KFunction1<Int, Unit>>(y)
checkSubtype<KFunction0<String>>(z)
}
@@ -1,3 +1,5 @@
// !CHECK_TYPE
import kotlin.reflect.*
class A
@@ -12,8 +14,8 @@ class B {
val y = ::bar
val z = ::baz
x : KFunction0<Unit>
y : KFunction1<Int, Unit>
z : KFunction0<String>
checkSubtype<KFunction0<Unit>>(x)
checkSubtype<KFunction1<Int, Unit>>(y)
checkSubtype<KFunction0<String>>(z)
}
}
@@ -1,3 +1,5 @@
// !CHECK_TYPE
import kotlin.reflect.*
fun foo() {}
@@ -9,7 +11,7 @@ fun main() {
val y = ::bar
val z = ::baz
x : KFunction0<Unit>
y : KFunction1<Int, Unit>
z : KFunction0<String>
checkSubtype<KFunction0<Unit>>(x)
checkSubtype<KFunction1<Int, Unit>>(y)
checkSubtype<KFunction0<String>>(z)
}