Skip to content

Commit 56cb7ea

Browse files
committed
fix autoconversion bug
attention with autoconversions around `Option[Int]` and similar: ``` scala> Option(null: Integer) val res0: Option[Integer] = None scala> val o: Option[Int] = Option(null: Integer) val o: Option[Int] = Some(0) scala> val o: Option[Int] = Option(null: Integer).asInstanceOf[Option[Int]] val o: Option[Int] = None ```
1 parent 1b07d78 commit 56cb7ea

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

codegen/src/main/scala/overflowdb/codegen/CodeGen.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1826,7 +1826,7 @@ class CodeGen(schema: Schema) {
18261826

18271827
case Cardinality.ZeroOrOne =>
18281828
s"""def $name(value: $valueTypeNullable): this.type = {
1829-
| this.$name = Option(value)
1829+
| this.$name = Option(value).asInstanceOf[Option[$valueType]]
18301830
| this
18311831
|}
18321832
|

0 commit comments

Comments
 (0)