Skip to content

Commit 2e5db2c

Browse files
committed
Fix -Ycheck:all error: mismatch of parents
1 parent 70bef2e commit 2e5db2c

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
@@ -561,7 +561,9 @@ class PostTyper extends MacroTransform with InfoTransformer { thisPhase =>
561561
then
562562
sym.addAnnotation(Annotation(defn.ExperimentalAnnot, sym.span))
563563

564-
private def scala2LibPatch(tree: TypeDef)(using Context) =
564+
// It needs to run at the phase of the postTyper --- otherwise, the test of the symbols will use
565+
// the transformed denotation with added `Serializable` and `AbstractFunction`.
566+
private def scala2LibPatch(tree: TypeDef)(using Context) = atPhase(thisPhase):
565567
val sym = tree.symbol
566568
if compilingScala2StdLib && sym.is(ModuleClass) then
567569
// 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)