Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Projections are not allowed on type arguments of functions and properties in generated code #132

Closed
soberich opened this issue Apr 25, 2019 · 1 comment

Comments

@soberich
Copy link

soberich commented Apr 25, 2019

snippet with code with comments is descriptive
FIXME: comments shows the problem.
TODOs are just what IDEA highlights.
P.S. 1 at the end of type name is just for to avoid clash on my side.

package com.example

import java.math.BigDecimal
import java.time.LocalDate
import java.time.Month
import java.time.Year

interface RecordCollection1 {
    val _id                 : Long
    val year                : Year
    val month               : Month
    val records             : List<Record1>
}

interface Record1 {
    val date                : LocalDate
    val type                : String
    val hoursSubmitted      : BigDecimal
    val desc                : String?
    val report              : RecordCollection1
}

interface Employee1 {
    val _id                 : Long
    val records             : List<RecordCollection1>
}

data class RecordCollectionImpl1(
    override val _id                 : Long,
    override val year                : Year,
    override val month               : Month
) : RecordCollection1 {
    override lateinit var records: List<Record1>
}

data class EmployeeAggregate1(override val _id: Long): Employee1 {
    override lateinit var records    : List<RecordCollection1>
}


/**
 * GENERATED CODE 
 */

package com.example

import kotlin.Long
import kotlin.String
import kotlin.Suppress
import kotlin.collections.Collection
import kotlin.collections.List
import kotlin.collections.Map
import kotlin.reflect.KProperty1
import org.litote.kmongo.property.KCollectionPropertyPath
import org.litote.kmongo.property.KCollectionSimplePropertyPath
import org.litote.kmongo.property.KMapPropertyPath
import org.litote.kmongo.property.KPropertyPath
                                                          //TODO Improvement: redundunt `out` here (IDEA says)
private val __Records: KProperty1<EmployeeAggregate1, List<out RecordCollection1?>?>
    get() = EmployeeAggregate1::records
private val ___id: KProperty1<EmployeeAggregate1, Long?>
    get() = EmployeeAggregate1::_id
class EmployeeAggregate1_<T>(previous: KPropertyPath<T, *>?, property: KProperty1<*,
        EmployeeAggregate1?>) : KPropertyPath<T, EmployeeAggregate1?>(previous,property) {
    val records: KCollectionSimplePropertyPath<T, out RecordCollection1??>
        get() = KCollectionSimplePropertyPath<T, out //FIXME: Projections are not allowed on type arguments of functions and properties
        RecordCollection1??>(this,EmployeeAggregate1::records)
                       // ^ TODO Improvement: redundunt double `?` here AND BELOW everywhere with `??` (IDEA says)
    val _id: KPropertyPath<T, Long?>
        get() = KPropertyPath<T, Long?>(this,___id)

    companion object {
        val Records: KCollectionSimplePropertyPath<EmployeeAggregate1, out RecordCollection1??>
            get() = KCollectionSimplePropertyPath(null, __Records)
        val _id: KProperty1<EmployeeAggregate1, Long?>
            get() = ___id}
}

class EmployeeAggregate1_Col<T>(previous: KPropertyPath<T, *>?, property: KProperty1<*,
        Collection<EmployeeAggregate1>?>) : KCollectionPropertyPath<T, EmployeeAggregate1?,
        EmployeeAggregate1_<T>>(previous,property) {
    val records: KCollectionSimplePropertyPath<T, out RecordCollection1??>
        get() = KCollectionSimplePropertyPath<T, out //FIXME: Projections are not allowed on type arguments of functions and properties
        RecordCollection1??>(this,EmployeeAggregate1::records)

    val _id: KPropertyPath<T, Long?>
        get() = KPropertyPath<T, Long?>(this,___id)

    @Suppress("UNCHECKED_CAST")
    override fun memberWithAdditionalPath(additionalPath: String): EmployeeAggregate1_<T> =
            EmployeeAggregate1_(this, customProperty(this, additionalPath))}

class EmployeeAggregate1_Map<T, K>(previous: KPropertyPath<T, *>?, property: KProperty1<*, Map<K,
        EmployeeAggregate1>?>) : KMapPropertyPath<T, K, EmployeeAggregate1?,
        EmployeeAggregate1_<T>>(previous,property) {
    val records: KCollectionSimplePropertyPath<T, out RecordCollection1??>
        get() = KCollectionSimplePropertyPath<T, out //FIXME: Projections are not allowed on type arguments of functions and properties
        RecordCollection1??>(this,EmployeeAggregate1::records)

    val _id: KPropertyPath<T, Long?>
        get() = KPropertyPath<T, Long?>(this,___id)

    @Suppress("UNCHECKED_CAST")
    override fun memberWithAdditionalPath(additionalPath: String): EmployeeAggregate1_<T> =
            EmployeeAggregate1_(this, customProperty(this, additionalPath))}
@zigzago
Copy link
Member

zigzago commented May 1, 2019

Thanks for reporting

@zigzago zigzago closed this as completed in 87a9762 May 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants