summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/matching/PatternMatchers.scala3
-rw-r--r--src/library/scala/xml/Null.scala7
2 files changed, 7 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/matching/PatternMatchers.scala b/src/compiler/scala/tools/nsc/matching/PatternMatchers.scala
index d318e79fcb..1bcb67c52d 100644
--- a/src/compiler/scala/tools/nsc/matching/PatternMatchers.scala
+++ b/src/compiler/scala/tools/nsc/matching/PatternMatchers.scala
@@ -77,7 +77,6 @@ trait PatternMatchers requires (transform.ExplicitOuter with PatternNodes) {
this.selector = selector
this.handleOuter = handleOuter
this.root = pConstrPat(selector.pos, selector.tpe.widen);
-
this.root.and = pHeader(selector.pos,
selector.tpe.widen,
Ident(root.symbol).setType(root.tpe));
@@ -1229,7 +1228,7 @@ print()
}
}
val succ = squeezedBlock(List(ValDef(casted,
- typed(gen.mkAsInstanceOf(selector.duplicate, ntpe, true)))),
+ if(isSubType(selector.tpe,ntpe)) selector.duplicate else typed(gen.mkAsInstanceOf(selector.duplicate, ntpe, true)))),
toTree(node.and))
val fail = toTree(node.or, selector.duplicate)
diff --git a/src/library/scala/xml/Null.scala b/src/library/scala/xml/Null.scala
index eedc208a2c..a95fe4f389 100644
--- a/src/library/scala/xml/Null.scala
+++ b/src/library/scala/xml/Null.scala
@@ -11,6 +11,7 @@
package scala.xml
+import Predef.IllegalArgumentException
import compat.StringBuilder
case object Null extends MetaData {
@@ -55,7 +56,11 @@ case object Null extends MetaData {
def next = null
/** null */
- def apply(key: String) = null
+ def apply(key: String) = {
+ if(!Parsing.isNameStart (key charAt 0))
+ throw new IllegalArgumentException("not a valid attribute name '"+key+"', so can never match !")
+ null
+ }
/** gets value of qualified (prefixed) attribute with given key */
def apply(namespace: String, scope: NamespaceBinding, key: String) = null