Skip to content

Commit

Permalink
fix pickling
Browse files Browse the repository at this point in the history
  • Loading branch information
noti0na1 committed Jan 28, 2022
1 parent ab0156b commit 29148d2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
3 changes: 1 addition & 2 deletions compiler/src/dotty/tools/dotc/core/TyperState.scala
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,7 @@ class TyperState() {
* which is not yet committed, or which does not have a parent.
*/
def uncommittedAncestor: TyperState =
// TODO
if (isCommitted) previous.nn.uncommittedAncestor else this
if (isCommitted && previous != null) previous.uncheckedNN.uncommittedAncestor else this

/** Commit typer state so that its information is copied into current typer state
* In addition (1) the owning state of undetermined or temporarily instantiated
Expand Down
1 change: 1 addition & 0 deletions compiler/src/dotty/tools/dotc/core/Types.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2878,6 +2878,7 @@ object Types {
}
}

// `refFn` can be null only if `computed` is true.
case class LazyRef(private var refFn: (Context => (Type | Null)) | Null) extends UncachedProxyType with ValueType {
private var myRef: Type | Null = null
private var computed = false
Expand Down
5 changes: 5 additions & 0 deletions compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ class PlainPrinter(_ctx: Context) extends Printer {
tp match {
case tp: ThisType if tp.cls.is(Package) && !tp.cls.isEffectiveRoot =>
requiredPackage(tp.cls.fullName).termRef
case tp: TypeRef =>
val tp1 = tp.dealiasKeepAnnots
if tp1 ne tp then homogenize(tp1) else tp
case tp: TypeVar if tp.isInstantiated =>
homogenize(tp.instanceOpt)
case AndType(tp1, tp2) =>
Expand All @@ -60,6 +63,8 @@ class PlainPrinter(_ctx: Context) extends Printer {
if !ctx.mode.is(Mode.Type) && annot.symbol == defn.UncheckedVarianceAnnot =>
homogenize(parent)
case tp: SkolemType =>
// println(tp.info)
// println(tp.info.widen)
homogenize(tp.info)
case tp: LazyRef =>
homogenize(tp.ref)
Expand Down
4 changes: 2 additions & 2 deletions compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -387,10 +387,10 @@ object ProtoTypes {
case _ =>
targ = typerFn(arg)
if ctx.reporter.hasUnreportedErrors then
if hasInnerErrors(targ) then
if hasInnerErrors(targ.nn) then
state.errorArgs += arg
else
state.typedArg = state.typedArg.updated(arg, targ)
state.typedArg = state.typedArg.updated(arg, targ.nn)
state.errorArgs -= arg
}
targ.nn
Expand Down

0 comments on commit 29148d2

Please sign in to comment.