Inconsistency of Option[A] === A between NumericalTypeExpression and NonNumericalTypeExpression
The following compiles :
but not
The cause is here :
https://github.com/max-l/Squeryl/blob/master/src/main/scala/org/squeryl/dsl/TypeArithmetic.scala#L444
emulateSqlTyping1 does not work (it doesn't get applied) while emulateSqlTyping2 does
Option(1) === 1
1 === Option(1)
but not
Option("") === ""
"" === Option("")
The cause is here :
https://github.com/max-l/Squeryl/blob/master/src/main/scala/org/squeryl/dsl/TypeArithmetic.scala#L444
implicit def emulateSqlTyping1[A](e: NonNumericalExpression[Option[A]]): NonNumericalExpression[A] = new NonNumericalInputOnlyTypeConversion(e)
implicit def emulateSqlTyping2[A](e: NumericalExpression[Option[A]]): NumericalExpression[A] = new NumericalInputOnlyTypeConversion(e)
emulateSqlTyping1 does not work (it doesn't get applied) while emulateSqlTyping2 does
Leave a comment
on 2011-12-02 13:50 *
By maxime.levesque
Description changed from h2. Arguments for :
# SQ... to The following compiles :
Summary changed from Investigate the possibility of === (equality expression) to allow A === Option[A] or Option[A] === A to In consistency of A === Option[A] or Option[A] === A between NumericalTypeExpression and NonNumericalTypeExpression
on 2011-12-02 13:50 *
By maxime.levesque
Summary changed from In consistency of A === Option[A] or Option[A] === A between NumericalTypeExpression and NonNumericalTypeExpression to Inconsistency of Option[A] === A between NumericalTypeExpression and NonNumericalTypeExpression