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,16 +1,18 @@
// !CHECK_TYPE
fun test(bal: Array<Int>) {
var bar = 4
val a = { bar += 4 }
a : () -> Unit
checkSubtype<() -> Unit>(a)
val b = { bar = 4 }
b : () -> Unit
checkSubtype<() -> Unit>(b)
val c = { bal[2] = 3 }
c : () -> Unit
checkSubtype<() -> Unit>(c)
val d = run { bar += 4 }
d : Unit
checkSubtype<Unit>(d)
}
fun <T> run(f: () -> T): T = f()
@@ -6,5 +6,5 @@ fun test() {
} else {
{ 2 }
}
a checkType { it : _<() -> Int> }
a checkType { _<() -> Int>() }
}
@@ -3,5 +3,5 @@ fun <T> id(t: T) = t
fun foo() {
val i = id { 22 } //type inference error: no information for parameter
i checkType { it : _<()->Int> }
i checkType { _<()->Int>() }
}
@@ -1,9 +1,11 @@
// !CHECK_TYPE
fun test2(a: Int) {
val x = run f@{
if (a > 0) <!RETURN_NOT_ALLOWED!>return<!>
return@f 1
}
x: Int
checkSubtype<Int>(x)
}
fun run<T>(f: () -> T): T { return f() }
@@ -1,6 +1,8 @@
// !CHECK_TYPE
fun test2() {
val x = run f@{return@f 1}
x: Int
checkSubtype<Int>(x)
}
fun run<T>(f: () -> T): T { return f() }
@@ -1,12 +1,14 @@
// !CHECK_TYPE
fun test() {
val x = run(f@{return@f 1})
x: Int
checkSubtype<Int>(x)
}
fun test1() {
val x = run(l@{return@l 1})
x: Int
checkSubtype<Int>(x)
}
fun run<T>(f: () -> T): T { return f() }
@@ -1,6 +1,8 @@
// !CHECK_TYPE
fun test() {
run1 f@{
(return@f 1)<!UNREACHABLE_CODE!>: Nothing<!>
<!UNREACHABLE_CODE!>checkSubtype<Nothing>(<!>return@f 1<!UNREACHABLE_CODE!>)<!>
}
}
@@ -1,3 +1,5 @@
// !CHECK_TYPE
fun test() {
val x = run f@{
fun local(a: Int): String {
@@ -6,7 +8,7 @@ fun test() {
}
return@f 1
}
x: Int
checkSubtype<Int>(x)
}
fun run<T>(f: () -> T): T { return f() }
@@ -1,3 +1,5 @@
// !CHECK_TYPE
fun test() {
val x = run f@{
run ff@ {
@@ -5,7 +7,7 @@ fun test() {
}
return@f 1
}
x: Int
checkSubtype<Int>(x)
}
fun run<T>(f: () -> T): T { return f() }
@@ -1,9 +1,11 @@
// !CHECK_TYPE
fun test(a: Int) {
val x = run f@{
if (a > 0) return@f
else return@f Unit
}
x: Unit
checkSubtype<Unit>(x)
}
fun run<T>(f: () -> T): T { return f() }
@@ -1,3 +1,5 @@
// !CHECK_TYPE
trait A
trait B: A
trait C: A
@@ -8,7 +10,7 @@ fun test(a: C, b: B) {
if (a != b) return@f a
b
}
x: A
checkSubtype<A>(x)
}
fun run<T>(f: () -> T): T { return f() }