Skip to content

Commit 755c242

Browse files
committed
Use union type for TypeOrSymbol
1 parent b2cd761 commit 755c242

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -939,7 +939,7 @@ object SymDenotations {
939939
if (this.is(ModuleClass))
940940
myInfo match {
941941
case ClassInfo(_, _, _, _, selfType) =>
942-
def sourceOfSelf(tp: TypeOrSymbol): Symbol = tp match {
942+
def sourceOfSelf(tp: TypeOrSymbol): Symbol = (tp: @unchecked) match {
943943
case tp: TermRef => tp.symbol
944944
case tp: Symbol => sourceOfSelf(tp.info)
945945
case tp: RefinedType => sourceOfSelf(tp.parent)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3940,7 +3940,7 @@ object Types {
39403940

39413941
// ------ ClassInfo, Type Bounds --------------------------------------------------
39423942

3943-
type TypeOrSymbol = AnyRef /* should be: Type | Symbol */
3943+
type TypeOrSymbol = Type | Symbol
39443944

39453945
/** Roughly: the info of a class during a period.
39463946
* @param prefix The prefix on which parents, decls, and selfType need to be rebased.
@@ -4618,7 +4618,7 @@ object Types {
46184618
override def mapClassInfo(tp: ClassInfo): ClassInfo = {
46194619
val prefix1 = this(tp.prefix)
46204620
val parents1 = tp.parents mapConserve this
4621-
val selfInfo1 = tp.selfInfo match {
4621+
val selfInfo1: TypeOrSymbol = tp.selfInfo match {
46224622
case selfInfo: Type => this(selfInfo)
46234623
case selfInfo => selfInfo
46244624
}

compiler/src/dotty/tools/dotc/printing/Formatting.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ object Formatting {
8686
}
8787
}
8888

89-
private def wrapNonSensical(arg: Any /* Type | Symbol */, str: String)(implicit ctx: Context): String = {
89+
private def wrapNonSensical(arg: Any, str: String)(implicit ctx: Context): String = {
9090
import MessageContainer._
9191
def isSensical(arg: Any): Boolean = arg match {
9292
case tpe: Type =>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ trait NamerContextOps { this: Context =>
102102
}
103103

104104
/** A new context for the interior of a class */
105-
def inClassContext(selfInfo: AnyRef /* Should be Type | Symbol*/): Context = {
105+
def inClassContext(selfInfo: TypeOrSymbol): Context = {
106106
val localCtx: Context = ctx.fresh.setNewScope
107107
selfInfo match {
108108
case sym: Symbol if sym.exists && sym.name != nme.WILDCARD => localCtx.scope.openForMutations.enter(sym)

0 commit comments

Comments
 (0)