Skip to content

Commit 1559fb6

Browse files
committed
More cleanups
1 parent 6151e35 commit 1559fb6

File tree

4 files changed

+3
-59
lines changed

4 files changed

+3
-59
lines changed

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

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -426,43 +426,6 @@ object SymDenotations {
426426
case _ => unforcedDecls.openForMutations
427427
}
428428

429-
/** If this is a synthetic opaque type alias, mark it as Deferred with bounds
430-
* as given by the right hand side's `WithBounds` annotation, if one is present,
431-
* or with empty bounds of the right kind, otherwise.
432-
* At the same time, integrate the original alias as a refinement of the
433-
* self type of the enclosing class.
434-
*/
435-
final def normalizeOpaque()(implicit ctx: Context) = {
436-
def abstractRHS(tp: Type): Type = tp match {
437-
case tp: HKTypeLambda => tp.derivedLambdaType(resType = abstractRHS(tp.resType))
438-
case _ => defn.AnyType
439-
}
440-
if (isOpaqueAlias)
441-
info match {
442-
case TypeAlias(alias) =>
443-
val (refiningAlias, bounds) = alias match {
444-
case AnnotatedType(alias1, Annotation.WithBounds(bounds)) =>
445-
(alias1, bounds)
446-
case _ =>
447-
(alias, TypeBounds(defn.NothingType, abstractRHS(alias)))
448-
}
449-
def refineSelfType(selfType: Type) =
450-
RefinedType(selfType, name, TypeAlias(refiningAlias))
451-
val enclClassInfo = owner.asClass.classInfo
452-
enclClassInfo.selfInfo match {
453-
case self: Type =>
454-
owner.info = enclClassInfo.derivedClassInfo(
455-
selfInfo = refineSelfType(self.orElse(defn.AnyType)))
456-
case self: Symbol =>
457-
self.info = refineSelfType(self.info)
458-
}
459-
info = bounds
460-
setFlag(Deferred)
461-
typeRef.recomputeDenot()
462-
case _ =>
463-
}
464-
}
465-
466429
/** If this is an opaque alias, replace the right hand side `info`
467430
* by appropriate bounds and store `info` in the refinement of the
468431
* self type of the enclosing class.

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -838,8 +838,7 @@ class TreeUnpickler(reader: TastyReader,
838838
case _: TypeBounds | _: ClassInfo => checkNonCyclic(sym, rhs.tpe, reportErrors = false)
839839
case _ => rhs.tpe.toBounds
840840
}
841-
if sym.isOpaqueAlias then
842-
sym.typeRef.recomputeDenot() // make sure we see the new bounds from now on
841+
if sym.isOpaqueAlias then sym.typeRef.recomputeDenot() // make sure we see the new bounds from now on
843842
sym.resetFlag(Provisional)
844843
TypeDef(rhs)
845844
}

compiler/src/dotty/tools/dotc/typer/Namer.scala

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,9 +1156,9 @@ class Namer { typer: Typer =>
11561156
* accessors, that's why the constructor needs to be completed before
11571157
* the parent types are elaborated.
11581158
*/
1159-
def completeConstructor(denot: SymDenotation): TempClassInfo = {
1159+
def completeConstructor(denot: SymDenotation): Unit = {
11601160
if (tempInfo != null) // Constructor has been completed already
1161-
return tempInfo
1161+
return
11621162

11631163
addAnnotations(denot.symbol)
11641164

@@ -1191,7 +1191,6 @@ class Namer { typer: Typer =>
11911191

11921192
tempInfo = denot.asClass.classInfo.integrateOpaqueMembers.asInstanceOf[TempClassInfo]
11931193
denot.info = savedInfo
1194-
tempInfo
11951194
}
11961195

11971196
/** The type signature of a ClassDef with given symbol */

compiler/src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1832,23 +1832,6 @@ class Typer extends Namer
18321832
ctx.featureWarning(nme.dynamics.toString, "extension of type scala.Dynamic", cls, isRequired, cdef.sourcePos)
18331833
}
18341834

1835-
// TODO: Drop or use
1836-
def simplifyOpaques(tp: Type): Type = tp match
1837-
case tp @ RefinedType(parent, name, alias @ TypeAlias(lzy: LazyRef)) =>
1838-
tp.derivedRefinedType(simplifyOpaques(parent), name,
1839-
alias.derivedAlias(lzy.ref))
1840-
case _ =>
1841-
tp
1842-
1843-
if false && cls.containsOpaques then
1844-
val cinfo = cls.classInfo
1845-
cinfo.selfInfo match
1846-
case self: Type =>
1847-
cls.info = cinfo.derivedClassInfo(selfInfo = simplifyOpaques(self))
1848-
case self: Symbol =>
1849-
self.info = simplifyOpaques(self.info)
1850-
//println(i"simplified: $cls with ${cls.classInfo.selfInfo}")
1851-
18521835
checkNonCyclicInherited(cls.thisType, cls.classParents, cls.info.decls, cdef.posd)
18531836

18541837
// check value class constraints

0 commit comments

Comments
 (0)