Skip to content

Commit 51ed4eb

Browse files
Make case classes Serializable
1 parent 5aaa9c8 commit 51ed4eb

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

compiler/src/dotty/tools/dotc/ast/Desugar.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ object desugar {
513513
if (isEnumCase && parents.isEmpty)
514514
parents1 = enumClassTypeRef :: Nil
515515
if (isCaseClass | isCaseObject)
516-
parents1 = parents1 :+ scalaDot(str.Product.toTypeName)
516+
parents1 = parents1 :+ scalaDot(str.Product.toTypeName) :+ scalaDot(nme.Serializable.toTypeName)
517517
if (isEnum)
518518
parents1 = parents1 :+ ref(defn.EnumType)
519519

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
case class Foo()
2+
3+
object Test {
4+
def main(args: Array[String]): Unit =
5+
assert(Foo().isInstanceOf[Serializable])
6+
}

0 commit comments

Comments
 (0)