'is' works on class type parameters
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
class Foo() {}
|
||||
class Bar() {}
|
||||
|
||||
class InstanceChecker<T>() {
|
||||
fun check(obj: Any?) = obj is T
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val checker = InstanceChecker<Foo>()
|
||||
if (!checker.check(Foo())) return "fail 1"
|
||||
if (checker.check(Bar())) return "fail 2"
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user