File tree 3 files changed +31
-3
lines changed
compiler/src/dotty/tools/dotc/transform 3 files changed +31
-3
lines changed Original file line number Diff line number Diff line change @@ -425,7 +425,7 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisPhase
425
425
if sym.isOpaqueAlias then
426
426
VarianceChecker .checkLambda(rhs, TypeBounds .upper(sym.opaqueAlias))
427
427
case _ =>
428
- processMemberDef(super .transform(tree))
428
+ processMemberDef(super .transform(scala2LibPatch( tree) ))
429
429
case tree : Bind =>
430
430
if tree.symbol.isType && ! tree.symbol.name.is(WildcardParamName ) then
431
431
Checking .checkGoodBounds(tree.symbol)
@@ -534,5 +534,21 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisPhase
534
534
sym.addAnnotation(Annotation (defn.ExperimentalAnnot , sym.span))
535
535
sym.companionModule.addAnnotation(Annotation (defn.ExperimentalAnnot , sym.span))
536
536
537
+ private def scala2LibPatch (tree : TypeDef )(using Context ) =
538
+ val sym = tree.symbol
539
+ if ctx.settings.Yscala2Stdlib .value
540
+ && sym.isClass && sym.is(Module ) && ! sym.derivesFrom(defn.SerializableClass )
541
+ && sym.companionClass.derivesFrom(defn.SerializableClass )
542
+ then
543
+ // Add Serializable to companion objects of serializable classes
544
+ sym.info = sym.info match
545
+ case info : ClassInfo =>
546
+ info.derivedClassInfo(declaredParents = info.parents :+ defn.SerializableType )
547
+ tree.rhs match
548
+ case impl : Template =>
549
+ val parents1 = impl.parents :+ TypeTree (defn.SerializableType )
550
+ val impl1 = cpy.Template (impl)(parents = parents1)
551
+ cpy.TypeDef (tree)(rhs = impl1)
552
+ else tree
537
553
}
538
554
}
Original file line number Diff line number Diff line change @@ -51,7 +51,11 @@ object MiMaFilters {
51
51
52
52
// Companion module class
53
53
ProblemFilters .exclude[FinalClassProblem ](" scala.*$" ),
54
- ProblemFilters .exclude[MissingTypesProblem ](" scala.*$" ),
54
+
55
+ // Missing types {scala.runtime.AbstractFunction1}
56
+ ProblemFilters .exclude[MissingTypesProblem ](" scala.ScalaReflectionException$" ),
57
+ ProblemFilters .exclude[MissingTypesProblem ](" scala.UninitializedFieldError$" ),
58
+ ProblemFilters .exclude[MissingTypesProblem ](" scala.collection.StringView$" ),
55
59
56
60
// Tuples
57
61
ProblemFilters .exclude[FinalClassProblem ](" scala.Tuple1" ),
Original file line number Diff line number Diff line change @@ -76,7 +76,15 @@ object TastyMiMaFilters {
76
76
ProblemMatcher .make(ProblemKind .MissingTermMember , " scala.*$default$*" ), // To check (semantic names vs mangled name?)
77
77
78
78
// Problem: Missing Serializable in companions of serializable classes
79
- ProblemMatcher .make(ProblemKind .MissingParent , " scala.*$" ),
79
+ ProblemMatcher .make(ProblemKind .MissingParent , " scala.collection.Searching.Found$" ),
80
+ ProblemMatcher .make(ProblemKind .MissingParent , " scala.collection.Searching.InsertionPoint$" ),
81
+ ProblemMatcher .make(ProblemKind .MissingParent , " scala.jdk.FunctionWrappers.AsJava*$" ),
82
+ ProblemMatcher .make(ProblemKind .MissingParent , " scala.jdk.FunctionWrappers.FromJava*$" ),
83
+
84
+ // Missing types {scala.runtime.AbstractFunction1}
85
+ ProblemMatcher .make(ProblemKind .MissingParent , " scala.ScalaReflectionException$" ),
86
+ ProblemMatcher .make(ProblemKind .MissingParent , " scala.UninitializedFieldError$" ),
87
+ ProblemMatcher .make(ProblemKind .MissingParent , " scala.collection.StringView$" ),
80
88
81
89
// Problem: Class[T] or ClassTag[T] return type
82
90
ProblemMatcher .make(ProblemKind .IncompatibleTypeChange , " scala.*.getClass" ),
You can’t perform that action at this time.
0 commit comments