Describe the bug
Class with a generically typed property throws a compilation error when mapped to
To Reproduce
data class FooDto(
val id: String,
val name: String,
val description: String
)
data class Foo(
val uniqueId: String,
val name: String,
val description: String
)
data class Wrapper<W>(
val wrapped: W,
val name: String
)
object FooMapper : ObjectMappie<FooDto, Foo>() {
override fun map(from: FooDto): Foo = mapping {
to::uniqueId fromProperty from::id
}
}
object WrapperMapper : ObjectMappie<FooDto, Wrapper<Foo>>() {
override fun map(from: FooDto): Wrapper<Foo> = mapping {
to::wrapped fromValue FooMapper.map(from)
to::name fromProperty from::name
}
}
Throws error Target Wrapper<W>::wrapped of type W cannot be assigned from value of type Foo
Expected behavior
Code compiles and generic typed property can be mapped to a value of the correct type
Kotlin version
2.1.20
Mappie version
2.1.20-1.2.1
Mappie and Kotlin compatibility
yes
Invocation method
Gradle 8.12.1
Describe the bug
Class with a generically typed property throws a compilation error when mapped to
To Reproduce
Throws error
Target Wrapper<W>::wrapped of type W cannot be assigned from value of type FooExpected behavior
Code compiles and generic typed property can be mapped to a value of the correct type
Kotlin version
2.1.20
Mappie version
2.1.20-1.2.1
Mappie and Kotlin compatibility
yes
Invocation method
Gradle 8.12.1