Skip to content

Commit 97a757c

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 90b580b commit 97a757c

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
@@ -384,8 +384,6 @@ object SymDenotations {
384384
if (isOpaqueAlias) {
385385
info match {
386386
case TypeAlias(alias) =>
387-
info = TypeBounds(defn.NothingType, abstractRHS(alias))
388-
389387
def refineSelfType(selfType: Type) =
390388
RefinedType(selfType, name, TypeAlias(alias))
391389
val enclClassInfo = owner.asClass.classInfo
@@ -395,8 +393,9 @@ object SymDenotations {
395393
case self: Symbol =>
396394
self.info = refineSelfType(self.info)
397395
}
398-
396+
info = TypeBounds(defn.NothingType, abstractRHS(alias))
399397
setFlag(Deferred)
398+
typeRef.recomputeDenot()
400399
case _ =>
401400
}
402401
}

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

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

0 commit comments

Comments
 (0)