File tree 2 files changed +10
-1
lines changed
compiler/src/dotty/tools/dotc/typer
2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -228,7 +228,7 @@ class Synthesizer(typer: Typer)(using @constructorOnly c: Context):
228
228
val monoTypeDef = untpd.TypeDef (tpnme.MirroredMonoType , untpd.TypeTree (monoType))
229
229
var newImpl = untpd.Template (
230
230
constr = untpd.emptyConstructor,
231
- parents = untpd.TypeTree (defn.ObjectType ) :: Nil ,
231
+ parents = untpd.TypeTree (defn.ObjectType ) :: untpd. TypeTree (defn. JavaSerializableClass .typeRef) :: Nil ,
232
232
derived = Nil ,
233
233
self = EmptyValDef ,
234
234
body = monoTypeDef :: Nil
Original file line number Diff line number Diff line change @@ -27,6 +27,10 @@ object Test {
27
27
}
28
28
}
29
29
30
+ // No Companion defined - therefore anonmymous mirror is generated
31
+ sealed trait NoCompanion
32
+ case class Value (value : String ) extends NoCompanion
33
+
30
34
def main (args : Array [String ]): Unit = {
31
35
val x : PartialFunction [Int , Int ] = { case x => x + 1 }
32
36
val adder = serializeDeserialize(x)
@@ -41,5 +45,10 @@ object Test {
41
45
val bar = new a.Bar
42
46
val bar1 = serializeDeserialize(bar)
43
47
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
44
53
}
45
54
}
You can’t perform that action at this time.
0 commit comments