Is there a way to override the declaration-site va...
# announcements
d
Is there a way to override the declaration-site variance for one specific method? I am writing a DSL and I have this method:
Copy code
infix fun <E : Any, P> KProperty1<in E, P>.eq(value: P): PredicateProvider<E>
Since
KProperty1
is declared as
KProperty<T, out R>
I can call my
eq
method like this:
Copy code
MyClass::id eq "hello"
even if
id
is of type
UUID
. The compiler then infers
Any
for
P
. Can I somehow tell the compiler... not to do that? Since that obviously does not make any sense here.