test for kt-702 added

#KT-702 fixed
This commit is contained in:
Svetlana Isakova
2012-07-31 20:20:16 +04:00
parent 1bf2ded875
commit 077f0084bd
@@ -0,0 +1,20 @@
package a
//+JDK
fun getJavaClass<T>() : java.lang.Class<T> { <!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
public class Throwables() {
class object {
public fun propagateIfInstanceOf<X : Throwable?>(throwable : Throwable?, declaredType : Class<X?>?) : Unit {
if (((throwable != null) && declaredType?.isInstance(throwable).sure()))
{
throw declaredType?.cast(throwable)!!
}
}
public fun propagateIfPossible(throwable : Throwable?) : Unit {
propagateIfInstanceOf(throwable, getJavaClass<Error?>()) // Type inference failed: Mismatch while expanding constraints
propagateIfInstanceOf(throwable, getJavaClass<RuntimeException?>()) // Type inference failed: Mismatch while expanding constraints
}
}
}