File tree Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -190,12 +190,4 @@ object Test extends App {
190190 val v2 = v0.ordinal(SumV2 .Right (" foo" ))
191191 assert(v2 == 1 )
192192 }
193-
194- sealed trait NoCompanion
195- case class Value (value : String ) extends NoCompanion
196-
197- {
198- val mirror = summon[Mirror .Of [NoCompanion ]]
199- assert(mirror.isInstanceOf [Serializable ])
200- }
201193}
Original file line number Diff line number Diff line change @@ -27,6 +27,10 @@ object Test {
2727 }
2828 }
2929
30+ // No Companion defined - therefore anonmymous mirror is generated
31+ sealed trait NoCompanion
32+ case class Value (value : String ) extends NoCompanion
33+
3034 def main (args : Array [String ]): Unit = {
3135 val x : PartialFunction [Int , Int ] = { case x => x + 1 }
3236 val adder = serializeDeserialize(x)
@@ -41,5 +45,10 @@ object Test {
4145 val bar = new a.Bar
4246 val bar1 = serializeDeserialize(bar)
4347 assert(bar.x eq bar1.x)
48+
49+ val mirror = summon[scala.deriving.Mirror .Of [NoCompanion ]]
50+ val mirror1 = serializeDeserialize(mirror)
51+ assert(mirror ne mirror1) // update if we start caching anonymous mirrors
52+ assert(mirror1.ordinal(Value (" " )) == 0 ) // check API
4453 }
4554}
You can’t perform that action at this time.
0 commit comments