diff options
author | Felix Mulder <felix.mulder@gmail.com> | 2016-05-19 16:54:53 +0200 |
---|---|---|
committer | Felix Mulder <felix.mulder@gmail.com> | 2016-05-19 16:54:53 +0200 |
commit | 772f3d20fd3605d077abf28e80195f1dda343ee1 (patch) | |
tree | c40e295f8524dd1194547cc704d6e11dba4d24a9 /src/dotty/tools/dotc/transform/PatternMatcher.scala | |
parent | 0dd8a135569b8f3f63d9c87fb5ad684d263db9f1 (diff) | |
download | dotty-772f3d20fd3605d077abf28e80195f1dda343ee1.tar.gz dotty-772f3d20fd3605d077abf28e80195f1dda343ee1.tar.bz2 dotty-772f3d20fd3605d077abf28e80195f1dda343ee1.zip |
Move `stripAnnots` to `isRef` instead of performing explicitly everywhere
Diffstat (limited to 'src/dotty/tools/dotc/transform/PatternMatcher.scala')
-rw-r--r-- | src/dotty/tools/dotc/transform/PatternMatcher.scala | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/dotty/tools/dotc/transform/PatternMatcher.scala b/src/dotty/tools/dotc/transform/PatternMatcher.scala index f8f32131b..d1737b55e 100644 --- a/src/dotty/tools/dotc/transform/PatternMatcher.scala +++ b/src/dotty/tools/dotc/transform/PatternMatcher.scala @@ -306,17 +306,11 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans def emitSwitch(scrut: Tree, scrutSym: Symbol, cases: List[List[TreeMaker]], pt: Type, matchFailGenOverride: Option[Symbol => Tree], unchecked: Boolean): Option[Tree] = { // TODO Deal with guards? - def isSwitchableType(tpe: Type): Boolean = { - val actualTpe = tpe match { - case t @ AnnotatedType(inner, _) => inner - case x => x - } - - (actualTpe isRef defn.IntClass) || - (actualTpe isRef defn.ByteClass) || - (actualTpe isRef defn.ShortClass) || - (actualTpe isRef defn.CharClass) - } + def isSwitchableType(tpe: Type): Boolean = + (tpe isRef defn.IntClass) || + (tpe isRef defn.ByteClass) || + (tpe isRef defn.ShortClass) || + (tpe isRef defn.CharClass) object IntEqualityTestTreeMaker { def unapply(treeMaker: EqualityTestTreeMaker): Option[Int] = treeMaker match { |