If I have: ```abstract class KomapperBaseRepositor...
# getting-started
d
If I have:
Copy code
abstract class KomapperBaseRepository<ENTITY : Any, ID : Any, META : EntityMetamodel<ENTITY, ID, META>>(
    private val db: R2dbcDatabase,
    private val entityMetamodel: META,
) {
    suspend fun create(entity: ENTITY): ENTITY = db.runQuery(QueryDsl.insert(entityMetamodel).single(entity))
}
how do I avoid having to provide all three type params when deriving from this? Doesn't the compiler infer them when I provide the entityMetamodel in the constructor?
j
Is it asking for all or just
ID
?
probably it is failing due
ID
, try
<_, whatever, _>
d
How do I provide only id...?
j
to allow inferring a type param you can use
_
d
Doesn't seem to be understood by Intellij...
It's asking me to create class
_
...
s
You need Kotlin 1.7+ to use the underscore, perhaps you're on an older version?
d
I WAS at language version 1.6, but I changed that... and updated to 1.9.23... maybe there's some lingering setting somewhere... which is really funny...
I'll check.
In the same file I put
data object Foo
and the IDE didn't complain... any other ideas @Sam?
It seems like
_
can only be used in calling functions: https://kotlinlang.org/docs/generics.html#underscore-operator-for-type-arguments, but not for deriving classes from...
j
Create a factory function or invoke function in the companion, but looks like a feature request to me\
d
How would that function help me in deriving a class from it?
j
I mean, the problem is instantiating
KomapperBaseRepository(…)
is not working with
_
, right? due it is a class
if it is a function, it should work, no?
d
I'm not instantiating it .... it's an abstract class I'm deriving from
j
Ah okay, sorry I missundertood that