diff --git a/compiler/src/dotty/tools/dotc/core/TyperState.scala b/compiler/src/dotty/tools/dotc/core/TyperState.scala index 1204ff121ec7..7eb13df9d829 100644 --- a/compiler/src/dotty/tools/dotc/core/TyperState.scala +++ b/compiler/src/dotty/tools/dotc/core/TyperState.scala @@ -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 diff --git a/compiler/src/dotty/tools/dotc/core/Types.scala b/compiler/src/dotty/tools/dotc/core/Types.scala index b068f38dd56d..6eecfb94fd16 100644 --- a/compiler/src/dotty/tools/dotc/core/Types.scala +++ b/compiler/src/dotty/tools/dotc/core/Types.scala @@ -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 diff --git a/compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala b/compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala index d2efbeff2901..d29e096da09e 100644 --- a/compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala +++ b/compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala @@ -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) => @@ -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) diff --git a/compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala b/compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala index fe5c8821288b..b7babdec5ec9 100644 --- a/compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala +++ b/compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala @@ -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