Skip to content

Commit 6acfbad

Browse files
committed
Use new opaques scheme also in Tasty reader
1 parent 043c237 commit 6acfbad

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import ast.{TreeTypeMap, Trees, tpd, untpd}
2525
import Trees._
2626
import Decorators._
2727
import transform.SymUtils._
28+
import config.Config
2829

2930
import dotty.tools.tasty.{TastyBuffer, TastyReader}
3031
import TastyBuffer._
@@ -570,6 +571,7 @@ class TreeUnpickler(reader: TastyReader,
570571
ctx.newSymbol(ctx.owner, name, flags, completer, privateWithin, coord)
571572
}
572573
sym.annotations = annotFns.map(_(sym))
574+
if sym.isOpaqueAlias then sym.setFlag(Deferred)
573575
ctx.owner match {
574576
case cls: ClassSymbol => cls.enter(sym)
575577
case _ =>
@@ -832,11 +834,14 @@ class TreeUnpickler(reader: TastyReader,
832834
override def completerTypeParams(sym: Symbol)(implicit ctx: Context) =
833835
rhs.tpe.typeParams
834836
}
835-
sym.info = rhs.tpe match {
837+
val rinfo = rhs.tpe match
836838
case _: TypeBounds | _: ClassInfo => checkNonCyclic(sym, rhs.tpe, reportErrors = false)
837839
case _ => rhs.tpe.toBounds
838-
}
839-
sym.normalizeOpaque()
840+
sym.info = if Config.newScheme then sym.opaqueToBounds(rinfo) else rinfo
841+
if Config.newScheme then
842+
if sym.isOpaqueAlias then
843+
sym.typeRef.recomputeDenot() // make sure we see the new bounds from now on
844+
else sym.normalizeOpaque()
840845
sym.resetFlag(Provisional)
841846
TypeDef(rhs)
842847
}
@@ -905,8 +910,10 @@ class TreeUnpickler(reader: TastyReader,
905910
}
906911
else EmptyValDef
907912
cls.setNoInitsFlags(parentsKind(parents), bodyFlags)
908-
cls.info = ClassInfo(cls.owner.thisType, cls, parentTypes, cls.unforcedDecls,
909-
if (self.isEmpty) NoType else self.tpt.tpe)
913+
val cinfo = ClassInfo(
914+
cls.owner.thisType, cls, parentTypes, cls.unforcedDecls,
915+
selfInfo = if (self.isEmpty) NoType else self.tpt.tpe)
916+
cls.info = if Config.newScheme then cinfo.integrateOpaqueMembers else cinfo
910917
val constr = readIndexedDef().asInstanceOf[DefDef]
911918
val mappedParents = parents.map(_.changeOwner(localDummy, constr.symbol))
912919

0 commit comments

Comments
 (0)