summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBurak Emir <emir@epfl.ch>2007-08-07 10:52:08 +0000
committerBurak Emir <emir@epfl.ch>2007-08-07 10:52:08 +0000
commitdc373d09bb53c606bf067e03f655cc404a313d41 (patch)
treee6e89ca45ae2d82fd8264420ba8ac17cda175956
parentd50a0095915c1d86edec691fdd187163037be7cb (diff)
downloadscala-dc373d09bb53c606bf067e03f655cc404a313d41.tar.gz
scala-dc373d09bb53c606bf067e03f655cc404a313d41.tar.bz2
scala-dc373d09bb53c606bf067e03f655cc404a313d41.zip
fixed #1213, added test case
-rw-r--r--src/compiler/scala/tools/nsc/matching/ParallelMatching.scala26
-rw-r--r--test/files/pos/patterns1213.scala11
2 files changed, 31 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala b/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala
index 5df7b3736d..bf7f777bfa 100644
--- a/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala
+++ b/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala
@@ -874,16 +874,27 @@ object Rep {
*/
val stpe =
if (o.tpe.termSymbol.isModule) {
- singleType(o.tpe.prefix, o.symbol)
- } else
- singleType(NoPrefix, o.symbol)
-
+ singleType(o.tpe.prefix, o.symbol)
+ } else {
+ singleType(NoPrefix, o.symbol) // equals-check
+ }
val p = Ident(nme.WILDCARD) setType stpe
val q = Typed(p, TypeTree(stpe)) setType stpe
pats = q::pats
} else
pats = o::pats
+ case o @ Select(_,_) =>
+ val stpe =
+ if (o.tpe.termSymbol.isModule) {
+ singleType(o.tpe.prefix, o.symbol)
+ } else {
+ singleType(NoPrefix, o.symbol) // equals-check
+ }
+ val p = Ident(nme.WILDCARD) setType stpe
+ val q = Typed(p, TypeTree(stpe)) setType stpe
+ pats = q::pats
+
case ua @ UnApply(Apply(fn, _), arg) =>
fn.tpe match {
case MethodType(List(argtpe,_*),_) =>
@@ -898,8 +909,10 @@ object Rep {
//Console.println(o)
//val stpe = singleType(NoPrefix, o.symbol)
val stpe =
- if (o.tpe./*?term?*/symbol.isModule) singleType(o.tpe.prefix, o.symbol)
- else mkThisType(o.symbol)
+ if (o.tpe.termSymbol.isModule) singleType(o.tpe.prefix, o.symbol)
+ else {
+ singleType(NoPrefix, o.symbol) // equals-check
+ }
val p = Ident(nme.WILDCARD) setType stpe
val q = Typed(p, TypeTree(stpe)) setType stpe
pats = q::pats
@@ -1133,6 +1146,7 @@ object Rep {
Equals(gen.mkAttributedRef(tpe.termSymbol), scrutineeTree) // object
} else {
//Console.print("111 ??")
+ //Console.println("tpe.prefix "+tpe.prefix)
//Console.println("tpe stable "+tpe.isStable)
//Console.println("tpe prefix stable "+tpe.prefix.isStable)
//val x = Equals(Apply(gen.mkAttributedRef(tpe./*?term?*/symbol), List()), scrutineeTree)
diff --git a/test/files/pos/patterns1213.scala b/test/files/pos/patterns1213.scala
new file mode 100644
index 0000000000..7b8a8c8fc0
--- /dev/null
+++ b/test/files/pos/patterns1213.scala
@@ -0,0 +1,11 @@
+abstract class MapLocation(ID:int) {
+ abstract class Message
+ case class ReceivePlayer(id: int) extends Message
+
+ def foo(p: Message) {
+ p match {
+ case ReceivePlayer(ID) =>
+ ()
+ }
+ }
+}