File tree 1 file changed +5
-1
lines changed
compiler/src/dotty/tools/dotc/typer
1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -1578,7 +1578,11 @@ class Typer extends Namer
1578
1578
val constr1 = typed(constr).asInstanceOf [DefDef ]
1579
1579
val parentsWithClass = ensureFirstTreeIsClass(parents mapconserve typedParent, cdef.namePos)
1580
1580
val parents1 = ensureConstrCall(cls, parentsWithClass)(superCtx)
1581
- val self1 = typed(self)(ctx.outer).asInstanceOf [ValDef ] // outer context where class members are not visible
1581
+ var self1 = typed(self)(ctx.outer).asInstanceOf [ValDef ] // outer context where class members are not visible
1582
+ if (cls.isOpaqueCompanion) {
1583
+ // this is necessary to ensure selftype is correctly pickled
1584
+ self1 = tpd.cpy.ValDef (self1)(tpt = TypeTree (cls.classInfo.selfType))
1585
+ }
1582
1586
if (self1.tpt.tpe.isError || classExistsOnSelf(cls.unforcedDecls, self1)) {
1583
1587
// fail fast to avoid typing the body with an error type
1584
1588
cdef.withType(UnspecifiedErrorType )
You can’t perform that action at this time.
0 commit comments