Skip to content

Commit 71f8413

Browse files
committed
Call normalizeOpaque in window of vulnerability
It turns out we get confused when we call normalizeOpaque as part of normal completion during computeDenot. Fine tuning normalizeOpaque and calling it in the window of vulnerability where a type is Opaque but not yet Deferred fixes the problem. Before the following tests failed when compiled from-tasty: tests/run/implicit-specifity.scala failed tests/pos/i5720.scala failed tests/pos/toplevel-opaque-xm failed tests/pos/postconditions.scala failed
1 parent 73e6bf2 commit 71f8413

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -382,8 +382,6 @@ object SymDenotations {
382382
if (isOpaqueAlias) {
383383
info match {
384384
case TypeAlias(alias) =>
385-
info = TypeBounds(defn.NothingType, abstractRHS(alias))
386-
387385
def refineSelfType(selfType: Type) =
388386
RefinedType(selfType, name, TypeAlias(alias))
389387
val enclClassInfo = owner.asClass.classInfo
@@ -393,8 +391,9 @@ object SymDenotations {
393391
case self: Symbol =>
394392
self.info = refineSelfType(self.info)
395393
}
396-
394+
info = TypeBounds(defn.NothingType, abstractRHS(alias))
397395
setFlag(Deferred)
396+
typeRef.recomputeDenot()
398397
case _ =>
399398
}
400399
}

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1883,8 +1883,10 @@ object Types {
18831883
finish(memberDenot(symd.initial.name, allowPrivate = false))
18841884
else if (prefix.isArgPrefixOf(symd))
18851885
finish(argDenot(sym.asType))
1886-
else if (infoDependsOnPrefix(symd, prefix))
1886+
else if (infoDependsOnPrefix(symd, prefix)) {
1887+
if (!symd.isClass && symd.is(Opaque, butNot = Deferred)) symd.normalizeOpaque()
18871888
finish(memberDenot(symd.initial.name, allowPrivate = symd.is(Private)))
1889+
}
18881890
else
18891891
finish(symd.current)
18901892
}

0 commit comments

Comments
 (0)