Skip to content

Commit

Permalink
prevent call to Expression.toString() when constructing Expression wi…
Browse files Browse the repository at this point in the history
…th `eq` method (JetBrains#1417)
  • Loading branch information
naftalmm authored Jan 15, 2022
1 parent e286051 commit eb6e68a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ interface ISqlExpressionBuilder {
}

/** Checks if this expression is equals to some [other] expression. */
infix fun <T, S1 : T?, S2 : T?> Expression<in S1>.eq(other: Expression<in S2>): Op<Boolean> = when {
other.equals(Op.NULL) -> isNull()
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)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,19 @@ class DDLTests : DatabaseTestsBase() {
}
}

@Test
fun testCheckConstraint03() {
object : Table("test") {
val testColumn: Column<Int?> = integer("test_column").nullable()

init {
check("test_constraint") {
testColumn.isNotNull() eq Op.TRUE
}
}
}
}

internal enum class Foo { Bar, Baz }

class PGEnum<T : Enum<T>>(enumTypeName: String, enumValue: T?) : PGobject() {
Expand Down

0 comments on commit eb6e68a

Please sign in to comment.