-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Correctly unpickle Scala 2 private case classes in traits (#16519)
Fixes #16443 I don't know how to make a test that reproduces the exact problem. In the test of this commit `TypeHints_1.scala` should be compiled with Scala 2.13, but I am not sure how to implement that.
- Loading branch information
Showing
4 changed files
with
26 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
@main def Test = | ||
println(NoTypeHints) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// This should be run with Scala 2.13 | ||
trait TypeHints { | ||
val hints: List[Class[_]] | ||
def components: List[TypeHints] = List(this) | ||
|
||
def + (hints: TypeHints): TypeHints = CompositeTypeHints(components ::: hints.components) | ||
|
||
private case class CompositeTypeHints(override val components: List[TypeHints]) extends TypeHints { | ||
override val hints: List[Class[_]] = components.flatMap(_.hints) | ||
} | ||
} | ||
|
||
case object NoTypeHints extends TypeHints { | ||
override val hints = Nil | ||
} |