Minor. update diagnostics/ReadMe.md

This commit is contained in:
Stanislav Erokhin
2015-12-17 19:51:34 +03:00
parent 2fb3c727a7
commit 1b6f96ac2b
+6 -3
View File
@@ -30,13 +30,16 @@ Must be
The directive adds the following declarations to the file:
class _<T>
fun <T> T.checkType(f: (_<T>) -> Unit) = f
fun <T> checkSubtype(t: T) = t
class Inv<T>
fun <E> Inv<E>._() {}
infix fun <T> T.checkType(f: Inv<T>.() -> Unit) {}
With that, an exact type of an expression can be checked in the following way:
fun test(expr: A) {
expr checkType { it: _<A> }
expr checkType { _<A>() }
}
#### Usage: