summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-04-06 04:33:46 +0000
committerPaul Phillips <paulp@improving.org>2011-04-06 04:33:46 +0000
commit7ec024951951b22afa3b074a921e40fcebb2b361 (patch)
tree1409c76f8aac7ed4d7737077845f0ed1970c8666
parente830a7ce9e1c90b4653c0dfed7992c28410ef6ab (diff)
downloadscala-7ec024951951b22afa3b074a921e40fcebb2b361.tar.gz
scala-7ec024951951b22afa3b074a921e40fcebb2b361.tar.bz2
scala-7ec024951951b22afa3b074a921e40fcebb2b361.zip
Misc cleanups and crash avoidance, no review.
-rw-r--r--src/compiler/scala/tools/nsc/backend/ScalaPrimitives.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala2
-rw-r--r--src/library/scala/xml/include/sax/EncodingHeuristics.scala18
-rw-r--r--test/files/neg/bug3736.check5
-rw-r--r--test/files/neg/super-cast-or-test.check7
-rw-r--r--test/files/neg/super-cast-or-test.scala3
6 files changed, 21 insertions, 16 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/ScalaPrimitives.scala b/src/compiler/scala/tools/nsc/backend/ScalaPrimitives.scala
index 436eb5fb90..bfd5b175a7 100644
--- a/src/compiler/scala/tools/nsc/backend/ScalaPrimitives.scala
+++ b/src/compiler/scala/tools/nsc/backend/ScalaPrimitives.scala
@@ -90,8 +90,6 @@ abstract class ScalaPrimitives {
// Any operations
final val IS = 80 // x.is[y]
final val AS = 81 // x.as[y]
- final val ISERASED = 85 // x.is$erased[y]
- final val ASERASED = 86 // x.as$erased[y]
final val HASH = 87 // x.##
// AnyRef operations
diff --git a/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala b/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala
index 83d72fc3a0..240f0c5f12 100644
--- a/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala
@@ -125,7 +125,7 @@ abstract class SuperAccessors extends transform.Transform with transform.TypingT
// otherwise lead to either a compiler crash or runtime failure.
private lazy val isDisallowed = {
import definitions._
- Set(Any_isInstanceOf, Object_isInstanceOf, Object_==, Object_!=, Object_##)
+ Set(Any_isInstanceOf, Object_isInstanceOf, Any_asInstanceOf, Object_asInstanceOf, Object_==, Object_!=, Object_##)
}
override def transform(tree: Tree): Tree = {
diff --git a/src/library/scala/xml/include/sax/EncodingHeuristics.scala b/src/library/scala/xml/include/sax/EncodingHeuristics.scala
index 349187437d..eaf0dffca8 100644
--- a/src/library/scala/xml/include/sax/EncodingHeuristics.scala
+++ b/src/library/scala/xml/include/sax/EncodingHeuristics.scala
@@ -14,14 +14,11 @@ import scala.xml.include._
import java.io.InputStream
import scala.util.matching.Regex
-/**
- * <p>
- * <code>EncodingHeuristics</code> reads from a stream
+/** `EncodingHeuristics` reads from a stream
* (which should be buffered) and attempts to guess
* what the encoding of the text in the stream is.
* If it fails to determine the type of the encoding,
* it returns the default UTF-8.
- * </p>
*
* @author Burak Emir
* @author Paul Phillips
@@ -40,16 +37,13 @@ object EncodingHeuristics
}
import EncodingNames._
- /**
- * <p>
- * This utility method attempts to determine the XML character encoding
- * by examining the input stream, as specified here:
- * http://www.w3.org/TR/xml/#sec-guessing
- * </p>
+ /** This utility method attempts to determine the XML character encoding
+ * by examining the input stream, as specified at
+ * [[http://www.w3.org/TR/xml/#sec-guessing w3]].
*
- * @param in <code>InputStream</code> to read from.
- * @return String The name of the encoding.
+ * @param in `InputStream` to read from.
* @throws IOException if the stream cannot be reset
+ * @return the name of the encoding.
*/
def readEncodingFromStream(in: InputStream): String = {
var ret: String = null
diff --git a/test/files/neg/bug3736.check b/test/files/neg/bug3736.check
index 8a91088914..cc222d1221 100644
--- a/test/files/neg/bug3736.check
+++ b/test/files/neg/bug3736.check
@@ -1,6 +1,9 @@
bug3736.scala:4: error: super not allowed here: use this.isInstanceOf instead
def f2 = super.isInstanceOf[String]
^
+bug3736.scala:5: error: super not allowed here: use this.asInstanceOf instead
+ def f3 = super.asInstanceOf[AnyRef]
+ ^
bug3736.scala:6: error: super not allowed here: use this.== instead
def f4 = super.==(new AnyRef)
^
@@ -10,4 +13,4 @@ bug3736.scala:7: error: super not allowed here: use this.!= instead
bug3736.scala:8: error: super not allowed here: use this.## instead
def f6 = super.##
^
-four errors found
+5 errors found
diff --git a/test/files/neg/super-cast-or-test.check b/test/files/neg/super-cast-or-test.check
new file mode 100644
index 0000000000..8e5eed62bd
--- /dev/null
+++ b/test/files/neg/super-cast-or-test.check
@@ -0,0 +1,7 @@
+super-cast-or-test.scala:1: error: super not allowed here: use this.asInstanceOf instead
+trait A { def f = super.asInstanceOf[AnyRef] }
+ ^
+super-cast-or-test.scala:2: error: super not allowed here: use this.isInstanceOf instead
+trait B { def g = super.isInstanceOf[AnyRef] }
+ ^
+two errors found
diff --git a/test/files/neg/super-cast-or-test.scala b/test/files/neg/super-cast-or-test.scala
new file mode 100644
index 0000000000..a0f86d8081
--- /dev/null
+++ b/test/files/neg/super-cast-or-test.scala
@@ -0,0 +1,3 @@
+trait A { def f = super.asInstanceOf[AnyRef] }
+trait B { def g = super.isInstanceOf[AnyRef] }
+