From 077f0084bd779637eb228c7420bb0d652db40e8f Mon Sep 17 00:00:00 2001 From: Svetlana Isakova Date: Tue, 31 Jul 2012 20:20:16 +0400 Subject: [PATCH] test for kt-702 added #KT-702 fixed --- .../tests/inference/regressions/kt702.kt | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 compiler/testData/diagnostics/tests/inference/regressions/kt702.kt diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt702.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt702.kt new file mode 100644 index 00000000000..e166ac1f352 --- /dev/null +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt702.kt @@ -0,0 +1,20 @@ +package a +//+JDK + +fun getJavaClass() : java.lang.Class { } + +public class Throwables() { + class object { + public fun propagateIfInstanceOf(throwable : Throwable?, declaredType : Class?) : Unit { + if (((throwable != null) && declaredType?.isInstance(throwable).sure())) + { + throw declaredType?.cast(throwable)!! + } + } + public fun propagateIfPossible(throwable : Throwable?) : Unit { + propagateIfInstanceOf(throwable, getJavaClass()) // Type inference failed: Mismatch while expanding constraints + propagateIfInstanceOf(throwable, getJavaClass()) // Type inference failed: Mismatch while expanding constraints + } + } +} +