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
@@ -8,13 +8,13 @@ fun <T> doA(a: A<T>): T = throw Exception("$a")
fun test(a: A<Int>, aN: A<Int?>) {
val aa = doA(aN)
aa checkType { it : _<Int?> }
aa checkType { _<Int?>() }
val nullable = foo(aN, aN)
//T = Int?, T? = Int? => T = Int?
nullable checkType { it : _<Int?> }
nullable checkType { _<Int?>() }
val notNullable = foo(a, aN)
//T = Int, T? = Int? => T = Int
notNullable checkType { it : _<Int> }
notNullable checkType { _<Int>() }
}
@@ -7,9 +7,9 @@ fun <T> foo1(f: (T) -> Unit): Foo<T> = Foo()
inline fun <reified T> foo2(f: (T) -> Unit): Foo<T> = Foo()
fun test1() {
val f1: Foo<out Int> = foo1 { it checkType { it : _<Int> } }
val f2: Foo<in Nothing> = foo1 { it <!UNREACHABLE_CODE!>checkType { it : _<Nothing> }<!> }
val f1: Foo<out Int> = foo1 { it checkType { _<Int>() } }
val f2: Foo<in Nothing> = foo1 { it <!UNREACHABLE_CODE!>checkType { _<Nothing>() }<!> }
val f3: Foo<out Int> = foo2 { it checkType { it : _<Int> } }
val f4: Foo<in Nothing> = <!REIFIED_TYPE_FORBIDDEN_SUBSTITUTION!>foo2<!> { it <!UNREACHABLE_CODE!>checkType { it : _<Nothing> }<!> }
val f3: Foo<out Int> = foo2 { it checkType { _<Int>() } }
val f4: Foo<in Nothing> = <!REIFIED_TYPE_FORBIDDEN_SUBSTITUTION!>foo2<!> { it <!UNREACHABLE_CODE!>checkType { _<Nothing>() }<!> }
}
@@ -14,7 +14,7 @@ fun test(out: Out<Int>, i: In<Int>, inv: A<Int>) {
// T? >: Int => T = Int
doT(1)
val r = doOut(out)
r checkType { it : _<Int> }
r checkType { _<Int>() }
// T? <: Int => error
doIn(<!TYPE_MISMATCH!>i<!>)
@@ -11,13 +11,13 @@ fun <T> doOut(o: Out<T?>): T = throw Exception("$o")
fun test(a: A<Int>, aN: A<Int?>, o: Out<Int?>) {
val out = doOut(o)
//T? >: Int? => T >: Int
out checkType { it : _<Int> }
out checkType { _<Int>() }
val nullable = foo(aN, o)
//T = Int?, T? >: Int? => T = Int?
nullable checkType { it : _<Int?> }
nullable checkType { _<Int?>() }
val notNullable = foo(a, o)
//T = Int, T? >: Int? => T = Int
notNullable checkType { it : _<Int> }
notNullable checkType { _<Int>() }
}
@@ -11,13 +11,13 @@ fun <T> doIn(i: In<T?>): T = throw Exception("$i")
fun test(a: A<Int>, aN: A<Int?>, i: In<Int?>) {
val _in = doIn(i)
//T? <: Int? => T <: Int?
_in checkType { it : _<Int?> }
_in checkType { _<Int?>() }
val notNullable = foo(a, i)
//T = Int, T? <: Int? => T = Int
notNullable checkType { it : _<Int> }
notNullable checkType { _<Int>() }
val nullable = foo(aN, i)
//T = Int?, T? <: Int? => T = Int?
nullable checkType { it : _<Int?> }
nullable checkType { _<Int?>() }
}