File tree 3 files changed +28
-3
lines changed
compiler/src/dotty/tools/dotc/transform 3 files changed +28
-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,18 @@ 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
+ tree.rhs match
545
+ case impl : Template =>
546
+ val parents1 = impl.parents :+ TypeTree (defn.SerializableType )
547
+ val impl1 = cpy.Template (impl)(parents = parents1)
548
+ cpy.TypeDef (tree)(rhs = impl1)
549
+ else tree
537
550
}
538
551
}
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 @@ -73,7 +73,15 @@ object TastyMiMaFilters {
73
73
ProblemMatcher .make(ProblemKind .MissingTermMember , " scala.*$default$*" ), // To check (semantic names vs mangled name?)
74
74
75
75
// Problem: Missing Serializable in companions of serializable classes
76
- ProblemMatcher .make(ProblemKind .MissingParent , " scala.*$" ),
76
+ ProblemMatcher .make(ProblemKind .MissingParent , " scala.collection.Searching.Found$" ),
77
+ ProblemMatcher .make(ProblemKind .MissingParent , " scala.collection.Searching.InsertionPoint$" ),
78
+ ProblemMatcher .make(ProblemKind .MissingParent , " scala.jdk.FunctionWrappers.AsJava*$" ),
79
+ ProblemMatcher .make(ProblemKind .MissingParent , " scala.jdk.FunctionWrappers.FromJava*$" ),
80
+
81
+ // Missing types {scala.runtime.AbstractFunction1}
82
+ ProblemMatcher .make(ProblemKind .MissingParent , " scala.ScalaReflectionException$" ),
83
+ ProblemMatcher .make(ProblemKind .MissingParent , " scala.UninitializedFieldError$" ),
84
+ ProblemMatcher .make(ProblemKind .MissingParent , " scala.collection.StringView$" ),
77
85
78
86
// Problem: Class[T] or ClassTag[T] return type
79
87
ProblemMatcher .make(ProblemKind .IncompatibleTypeChange , " scala.*.getClass" ),
You can’t perform that action at this time.
0 commit comments