Transform Throwable members to properties

This commit is contained in:
Denis Zharkov
2015-10-13 20:30:29 +03:00
committed by Mikhail Glukhikh
parent 9088bf67c7
commit 17c906658d
22 changed files with 63 additions and 51 deletions
+1 -3
View File
@@ -2,8 +2,6 @@
package foo
@native val Exception.message: String get() = noImpl
public fun <T : Throwable> failsWith(block: () -> Any): T {
try {
block()
@@ -20,5 +18,5 @@ fun box(): String {
throw Exception("OK")
}
return a.message
return a.message!!
}
@@ -1,6 +1,6 @@
package foo
class Fail(val message: String) : Exception(message)
class Fail(message: String) : Exception(message)
fun test(testName: String, actual: Any, expectedAsString: String) {
val expected = eval("[$expectedAsString]")
@@ -20,7 +20,7 @@ fun box(): String {
test("doubleArrayOf", doubleArrayOf(0.0, 1.1, 2.2, 3.3, 4.4), "0.0, 1.1, 2.2, 3.3, 4.4")
}
catch (e: Fail) {
return e.message
return e.message!!
}
return "OK"