JetBrains / Exposed

Kotlin SQL Framework
http://jetbrains.github.io/Exposed/
Apache License 2.0
8.1k stars 677 forks source link

fix: EXPOSED-114 Type parameter can't be inferred for EntityID with eq/neq op #1961

Closed bog-walk closed 6 months ago

bog-walk commented 6 months ago

The following warning shows when a comparison operator is used between an EntityID column and a column of matching non-EntityID type:

Type argument for a type parameter S2 can't be inferred because it has incompatible upper bounds: Int, EntityID (multiple incompatible classes). This will become an error in Kotlin 2.0

This happens because there is no overload for this type of comparison, so the overload being used is this one:

infix fun <T, S1 : T?, S2 : T?> Expression<in S1>.eq(other: Expression<in S2>): Op<Boolean> { }

Appropriate overloads have been added for each relevant comparison op.

scottkennedy commented 5 months ago

After updating to 0.47.0 from 0.46.0, I'm now getting:

Type argument for a type parameter E can't be inferred because it has incompatible upper bounds: UUID, EntityID (multiple incompatible classes). This will become an error in Kotlin 2.0

With this code:

val foo = uuid("foo")
val bar = uuid("bar")

fun test() {
    table.selectAll().where {
        table.foo eq table.bar
    }
}

This PR seems to be the only related change in the change log.

bog-walk commented 5 months ago

Hi @scottkennedy I came across this issue today as well and a fix will be pushed shortly.

Here is the issue ticket, EXPOSED-280, if you'd like to track it.