TypeInfo should be covariant. Consider the common case in Java when something wants, say, an annotation class. They write Class<? extends Annotation>. We can write just TypeInfo<Annotation>
This commit is contained in:
@@ -1,13 +1,13 @@
|
|||||||
namespace jet
|
namespace jet
|
||||||
|
|
||||||
namespace typeinfo {
|
namespace typeinfo {
|
||||||
class TypeInfo<T> {
|
class TypeInfo<out T> {
|
||||||
fun isSubtypeOf(other : TypeInfo<*>) : Boolean
|
fun isSubtypeOf(other : TypeInfo<*>) : Boolean
|
||||||
fun isInstance(obj : Any?) : Boolean
|
fun isInstance(obj : Any?) : Boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
fun typeinfo<T>() : TypeInfo<T>
|
fun typeinfo<T>() : TypeInfo<T>
|
||||||
fun typeinfo<T>(expression : T) : TypeInfo<out T>
|
fun typeinfo<T>(expression : T) : TypeInfo<T>
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace io {
|
namespace io {
|
||||||
|
|||||||
Reference in New Issue
Block a user