fun fn0() {} fun fn1(x: Any) {} inline fun assertReifiedIs(x: Any, type: String) { val answer: Boolean try { answer = x is T } catch (e: Throwable) { throw AssertionError("$x is $type: should not throw exceptions, got $e") } assert(answer) { "$x is $type: failed" } } inline fun assertReifiedIsNot(x: Any, type: String) { val answer: Boolean try { answer = x !is T } catch (e: Throwable) { throw AssertionError("$x !is $type: should not throw exceptions, got $e") } assert(answer) { "$x !is $type: failed" } } fun box(): String { val f0 = ::fn0 as Any val f1 = ::fn1 as Any assertReifiedIs>(f0, "Function0<*>") assertReifiedIs>(f1, "Function1<*, *>") assertReifiedIsNot>(f1, "Function0<*>") assertReifiedIsNot>(f0, "Function1<*, *>") return "OK" }