Skip to content

Commit 29148d2

Browse files
committed
fix pickling
1 parent ab0156b commit 29148d2

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

compiler/src/dotty/tools/dotc/core/TyperState.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,7 @@ class TyperState() {
119119
* which is not yet committed, or which does not have a parent.
120120
*/
121121
def uncommittedAncestor: TyperState =
122-
// TODO
123-
if (isCommitted) previous.nn.uncommittedAncestor else this
122+
if (isCommitted && previous != null) previous.uncheckedNN.uncommittedAncestor else this
124123

125124
/** Commit typer state so that its information is copied into current typer state
126125
* In addition (1) the owning state of undetermined or temporarily instantiated

compiler/src/dotty/tools/dotc/core/Types.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2878,6 +2878,7 @@ object Types {
28782878
}
28792879
}
28802880

2881+
// `refFn` can be null only if `computed` is true.
28812882
case class LazyRef(private var refFn: (Context => (Type | Null)) | Null) extends UncachedProxyType with ValueType {
28822883
private var myRef: Type | Null = null
28832884
private var computed = false

compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ class PlainPrinter(_ctx: Context) extends Printer {
5050
tp match {
5151
case tp: ThisType if tp.cls.is(Package) && !tp.cls.isEffectiveRoot =>
5252
requiredPackage(tp.cls.fullName).termRef
53+
case tp: TypeRef =>
54+
val tp1 = tp.dealiasKeepAnnots
55+
if tp1 ne tp then homogenize(tp1) else tp
5356
case tp: TypeVar if tp.isInstantiated =>
5457
homogenize(tp.instanceOpt)
5558
case AndType(tp1, tp2) =>
@@ -60,6 +63,8 @@ class PlainPrinter(_ctx: Context) extends Printer {
6063
if !ctx.mode.is(Mode.Type) && annot.symbol == defn.UncheckedVarianceAnnot =>
6164
homogenize(parent)
6265
case tp: SkolemType =>
66+
// println(tp.info)
67+
// println(tp.info.widen)
6368
homogenize(tp.info)
6469
case tp: LazyRef =>
6570
homogenize(tp.ref)

compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,10 +387,10 @@ object ProtoTypes {
387387
case _ =>
388388
targ = typerFn(arg)
389389
if ctx.reporter.hasUnreportedErrors then
390-
if hasInnerErrors(targ) then
390+
if hasInnerErrors(targ.nn) then
391391
state.errorArgs += arg
392392
else
393-
state.typedArg = state.typedArg.updated(arg, targ)
393+
state.typedArg = state.typedArg.updated(arg, targ.nn)
394394
state.errorArgs -= arg
395395
}
396396
targ.nn

0 commit comments

Comments
 (0)