Skip to content

Commit ae1a9e5

Browse files
committed
Fix -Ycheck:all error: mismatch of parents
1 parent 9bdf316 commit ae1a9e5

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

compiler/src/dotty/tools/dotc/transform/PostTyper.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,9 @@ class PostTyper extends MacroTransform with InfoTransformer { thisPhase =>
583583
if !sym.hasAnnotation(defn.ExperimentalAnnot) && ctx.settings.experimental.value && isTopLevelDefinitionInSource(sym) then
584584
sym.addAnnotation(ExperimentalAnnotation("Added by -experimental", sym.span))
585585

586-
private def scala2LibPatch(tree: TypeDef)(using Context) =
586+
// It needs to run at the phase of the postTyper --- otherwise, the test of the symbols will use
587+
// the transformed denotation with added `Serializable` and `AbstractFunction`.
588+
private def scala2LibPatch(tree: TypeDef)(using Context) = atPhase(thisPhase):
587589
val sym = tree.symbol
588590
if compilingScala2StdLib && sym.is(ModuleClass) then
589591
// Add Serializable to companion objects of serializable classes,
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
//> using options -Ysafe-init-global -Ycompile-scala2-library
1+
//> using options -Ycompile-scala2-library
22
case class UninitializedFieldError(msg: String) extends RuntimeException(msg)

0 commit comments

Comments
 (0)