summaryrefslogtreecommitdiff
path: root/test/files/neg
diff options
context:
space:
mode:
authorAntonio Cunei <antonio.cunei@epfl.ch>2010-09-14 14:33:23 +0000
committerAntonio Cunei <antonio.cunei@epfl.ch>2010-09-14 14:33:23 +0000
commit62fce2ceab1bc85319afbe17d4717bf03e563b45 (patch)
treeb00937e0a5b32ba20d813507561a870c4a1aac93 /test/files/neg
parent3ef8c7575deb5081bf623dde9d29c44648ce59af (diff)
downloadscala-62fce2ceab1bc85319afbe17d4717bf03e563b45.tar.gz
scala-62fce2ceab1bc85319afbe17d4717bf03e563b45.tar.bz2
scala-62fce2ceab1bc85319afbe17d4717bf03e563b45.zip
Merged revisions 22978-22979 via svnmerge from
https://lampsvn.epfl.ch/svn-repos/scala/scala/trunk ........ r22978 | moors | 2010-09-14 14:15:35 +0200 (Tue, 14 Sep 2010) | 3 lines closes #3692: make instantiateTypeVar more careful so it does not change T's info to >: T <: T. review by odersky ........ r22979 | moors | 2010-09-14 14:37:50 +0200 (Tue, 14 Sep 2010) | 10 lines closes #3612. relaxed self-type conformance check slightly by comparing the self types instead of the self-type symbols, which are trivially different when you introduce a self variable without giving it a type given the definitions below (for full context, see test file), before, O0 would work but O would not, now both are accepted: {{{ object O0 extends C {} object O extends C { self => } }}} review by odersky ........
Diffstat (limited to 'test/files/neg')
-rw-r--r--test/files/neg/t3692.check14
-rw-r--r--test/files/neg/t3692.scala17
2 files changed, 31 insertions, 0 deletions
diff --git a/test/files/neg/t3692.check b/test/files/neg/t3692.check
new file mode 100644
index 0000000000..ce89a6563d
--- /dev/null
+++ b/test/files/neg/t3692.check
@@ -0,0 +1,14 @@
+t3692.scala:11: warning: type Integer in package scala is deprecated: use <code>java.lang.Integer</code> instead
+ case m0: Map[Int, Int] => new java.util.HashMap[Integer, Integer]
+ ^
+t3692.scala:12: warning: type Integer in package scala is deprecated: use <code>java.lang.Integer</code> instead
+ case m1: Map[Int, V] => new java.util.HashMap[Integer, V]
+ ^
+t3692.scala:13: warning: type Integer in package scala is deprecated: use <code>java.lang.Integer</code> instead
+ case m2: Map[T, Int] => new java.util.HashMap[T, Integer]
+ ^
+t3692.scala:13: error: unreachable code
+ case m2: Map[T, Int] => new java.util.HashMap[T, Integer]
+ ^
+three warnings found
+one error found
diff --git a/test/files/neg/t3692.scala b/test/files/neg/t3692.scala
new file mode 100644
index 0000000000..78b0e4b843
--- /dev/null
+++ b/test/files/neg/t3692.scala
@@ -0,0 +1,17 @@
+object ManifestTester {
+ def main(args: Array[String]) = {
+ val map = Map("John" -> 1, "Josh" -> 2)
+ new ManifestTester().toJavaMap(map)
+ }
+}
+
+class ManifestTester {
+ private final def toJavaMap[T, V](map: Map[T, V])(implicit m1: Manifest[T], m2: Manifest[V]): java.util.Map[_, _] = {
+ map match {
+ case m0: Map[Int, Int] => new java.util.HashMap[Integer, Integer]
+ case m1: Map[Int, V] => new java.util.HashMap[Integer, V]
+ case m2: Map[T, Int] => new java.util.HashMap[T, Integer]
+ case _ => new java.util.HashMap[T, V]
+ }
+ }
+} \ No newline at end of file