aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/transform/PatternMatcher.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-11-07 12:58:33 +0100
committerMartin Odersky <odersky@gmail.com>2015-11-09 15:45:37 +0100
commit8978ae6dfabae562fb5dcf4c7f66983d4d865892 (patch)
tree999cd971a10b46ec307c550a5af464329495c6c9 /src/dotty/tools/dotc/transform/PatternMatcher.scala
parentf2b61ce055fccf96e305ef43fca8abef8a912f33 (diff)
downloaddotty-8978ae6dfabae562fb5dcf4c7f66983d4d865892.tar.gz
dotty-8978ae6dfabae562fb5dcf4c7f66983d4d865892.tar.bz2
dotty-8978ae6dfabae562fb5dcf4c7f66983d4d865892.zip
First versions of Definitions based on TypeRefs not Symbols.
Symbols are not stable between runs, so if some symbol referred to from Definitions gets recompiled, there are then two Symbols that are both visible, one referenced from Definitions, the other the one that got compiled. Thos led to a crash when e.g. compiling scala.Short, because the newly compiled symbol was not recognized as a primitive value class. The present commit tries to make systematic changes without regard to simplicity or aesthetics. This will be polished in future commits. // ### comments signal areas that need further attention.
Diffstat (limited to 'src/dotty/tools/dotc/transform/PatternMatcher.scala')
-rw-r--r--src/dotty/tools/dotc/transform/PatternMatcher.scala6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/transform/PatternMatcher.scala b/src/dotty/tools/dotc/transform/PatternMatcher.scala
index 2df7a9825..a47762ebe 100644
--- a/src/dotty/tools/dotc/transform/PatternMatcher.scala
+++ b/src/dotty/tools/dotc/transform/PatternMatcher.scala
@@ -134,7 +134,7 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans
// for name-based matching, but this was an expedient route for the basics.
def drop(tgt: Tree)(n: Int): Tree = {
def callDirect = tgt.select(nme.drop).appliedTo(Literal(Constant(n)))
- def callRuntime = ref(defn.traversableDropMethod).appliedTo(tgt, Literal(Constant(n)))
+ def callRuntime = ref(defn.ScalaRuntime_drop).appliedTo(tgt, Literal(Constant(n)))
def needsRuntime = !(tgt.tpe derivesFrom defn.SeqClass) /*typeOfMemberNamedDrop(tgt.tpe) == NoType*/
@@ -201,7 +201,7 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans
// catchAll.isEmpty iff no synthetic default case needed (the (last) user-defined case is a default)
// if the last user-defined case is a default, it will never jump to the next case; it will go immediately to matchEnd
val catchAllDef = matchFailGen.map { _(scrutSym)}
- .getOrElse(Throw(New(defn.MatchErrorType, List(ref(scrutSym)))))
+ .getOrElse(Throw(New(defn.MatchErrorTypeRef, List(ref(scrutSym)))))
val matchFail = newSynthCaseLabel(ctx.freshName("matchFail"), MethodType(Nil, restpe))
val catchAllDefBody = DefDef(matchFail, catchAllDef)
@@ -878,7 +878,7 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans
// unlike in scalac SubstOnlyTreeMakers are maintained.
val casesRebindingPropagated = casesRaw map (propagateRebindings(_, NoRebindings))
- def matchFailGen = matchFailGenOverride orElse Some((arg: Symbol) => Throw(New(defn.MatchErrorType, List(ref(arg)))))
+ def matchFailGen = matchFailGenOverride orElse Some((arg: Symbol) => Throw(New(defn.MatchErrorTypeRef, List(ref(arg)))))
ctx.debuglog("combining cases: " + (casesRebindingPropagated.map(_.mkString(" >> ")).mkString("{", "\n", "}")))