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 + } + } +} +