kotlin-orm/ktorm-ksp

interface 注解遇到 `operator` 关键字生成错误

onXoot opened this issue · 1 comments

ktorm-ksp version: 1.0.0-RC3
ktorm version: 3.5.0

code

@org.ktorm.ksp.api.Table("test")
interface TestOperator: org.ktorm.entity.Entity<TestOperator> {
    @org.ktorm.ksp.api.PrimaryKey
    var id: Long
    var operator: String
}

自动生成的代码

@Suppress("FunctionName")
public fun TestOperator(id: Long? = undefined(), operator_: String = undefined()): TestOperator {
    val entity = Entity.create<TestOperator>()
    if (id !== undefined<Long?>()) {
        entity.id = id ?: error("`entity` should not be null.")
    }
    if (operator !== undefined<String>()) {
        entity.operator = operator
    }
    return entity
}

public fun TestOperator.copy(id: Long? = undefined(), operator_: String = undefined()):
        TestOperator {
    val entity = this.copy()
    if (id !== undefined<Long?>()) {
        entity.id = id ?: error("`entity` should not be null.")
    }
    if (operator !== undefined<String>()) {
        entity.operator = operator
    }
    return entity
}

operator 在参数上自动加了个下划线,但是下面使用的时候没加 导致编译失败

使用实体类形式可以编译成功

好的,谢谢