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

fix: Tests testAdjustQueryHaving, testQueryAndHaving, and testQueryOrHaving resolve wrong eq function, and testGroupBy03 shows compiler warning #2016

Merged
merged 1 commit into from
Mar 4, 2024

Commits on Mar 1, 2024

  1. fix: Tests testAdjustQueryHaving, testQueryAndHaving, and `testQu…

    …eryOrHaving` resolve wrong `eq` function, and `testGroupBy03` shows compiler warning
    
    The tests `testAdjustQueryHaving`, `testQueryAndHaving`, and `testQueryOrHaving` falsely resolve this `eq` function
    
    infix fun <T : Comparable<T>, V : T?, E : EntityID<T>?> Expression<in V>.eq(
            other: ExpressionWithColumnType<E>
        ): Op<Boolean> = other eq this
    
    instead of this
    
    infix fun <T, S1 : T?, S2 : T?> Expression<in S1>.eq(other: Expression<in S2>): Op<Boolean> = when (other as Expression<*>) {
            is Op.NULL -> isNull()
            else -> EqOp(this, other)
        }
    
    The same happens when using `neq`, `less`, `lessEq`, `greater`, and `greaterEq`, so those are fixed in this commit too.
    
    Even when the correct function is resolved, a compiler warning still shows up because the compiler cannot infer the type of the argument when `Long` and `Int` are being compared. To remove the warning, the types are explicitly passed to the `eq` function like this `.eq<Number, Long, Int>`.
    
    This was tested with Kotlin 2.0.0-Beta4.
    joc-a committed Mar 1, 2024
    Configuration menu
    Copy the full SHA
    e18bf33 View commit details
    Browse the repository at this point in the history