Skip to content

Commit 772f3d2

Browse files
committed
Move stripAnnots to isRef instead of performing explicitly everywhere
1 parent 0dd8a13 commit 772f3d2

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ object Types {
105105
* It makes no sense for it to be an alias type because isRef would always
106106
* return false in that case.
107107
*/
108-
def isRef(sym: Symbol)(implicit ctx: Context): Boolean = stripTypeVar match {
108+
def isRef(sym: Symbol)(implicit ctx: Context): Boolean = stripAnnots.stripTypeVar match {
109109
case this1: TypeRef =>
110110
this1.info match { // see comment in Namer#typeDefSig
111111
case TypeAlias(tp) => tp.isRef(sym)

src/dotty/tools/dotc/transform/PatternMatcher.scala

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -306,17 +306,11 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans
306306
def emitSwitch(scrut: Tree, scrutSym: Symbol, cases: List[List[TreeMaker]], pt: Type, matchFailGenOverride: Option[Symbol => Tree], unchecked: Boolean): Option[Tree] = {
307307
// TODO Deal with guards?
308308

309-
def isSwitchableType(tpe: Type): Boolean = {
310-
val actualTpe = tpe match {
311-
case t @ AnnotatedType(inner, _) => inner
312-
case x => x
313-
}
314-
315-
(actualTpe isRef defn.IntClass) ||
316-
(actualTpe isRef defn.ByteClass) ||
317-
(actualTpe isRef defn.ShortClass) ||
318-
(actualTpe isRef defn.CharClass)
319-
}
309+
def isSwitchableType(tpe: Type): Boolean =
310+
(tpe isRef defn.IntClass) ||
311+
(tpe isRef defn.ByteClass) ||
312+
(tpe isRef defn.ShortClass) ||
313+
(tpe isRef defn.CharClass)
320314

321315
object IntEqualityTestTreeMaker {
322316
def unapply(treeMaker: EqualityTestTreeMaker): Option[Int] = treeMaker match {

0 commit comments

Comments
 (0)