Skip to content

Commit 8df5094

Browse files
committed
Add fromProductTyped tests
1 parent 488da51 commit 8df5094

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import deriving.Mirror
2+
3+
case class A(x: Int, y: String)
4+
case class B(a: Any, b: Any)
5+
object A:
6+
def f = summon[Mirror.ProductOf[A]].fromProductTyped((1, 2)) // error
7+
def g = summon[Mirror.ProductOf[A]].fromTuple((1, 2)) // error
8+
def h = summon[Mirror.ProductOf[B]].fromProductTyped(A(1, ""))
9+
def i = summon[Mirror.ProductOf[A]].fromProductTyped(B(1, "")) // error
10+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
case class A(x: Option[Int], y: Option[Any])
2+
case class B(x: Some[Int], y: Some[Boolean])
3+
4+
object Test extends App:
5+
import deriving.*
6+
7+
val ma = summon[Mirror.ProductOf[A]]
8+
9+
ma.fromProductTyped(B(Some(1), Some(true)))
10+
ma.fromProductTyped((Some(1), Some(false)))
11+

0 commit comments

Comments
 (0)