summaryrefslogtreecommitdiff
path: root/test/files/neg
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2007-01-25 15:50:26 +0000
committerMartin Odersky <odersky@gmail.com>2007-01-25 15:50:26 +0000
commit803488f3e2e1074c373cac55d8d4c08ac4a07eb9 (patch)
tree568687a91e8cf3c65c917cebc1b14a5573fb1570 /test/files/neg
parent44d630b0ced6d101a43955bd0755d098d6e613b2 (diff)
downloadscala-803488f3e2e1074c373cac55d8d4c08ac4a07eb9.tar.gz
scala-803488f3e2e1074c373cac55d8d4c08ac4a07eb9.tar.bz2
scala-803488f3e2e1074c373cac55d8d4c08ac4a07eb9.zip
1.
2. More detailed error messages for ambiguous implicits. 3. Relaxed rules for necessary overlap in pattern matching
Diffstat (limited to 'test/files/neg')
-rw-r--r--test/files/neg/bug900.check10
-rw-r--r--test/files/neg/bug900.scala5
-rw-r--r--test/files/neg/implicits.check5
-rw-r--r--test/files/neg/nopredefs.check4
-rw-r--r--test/files/neg/nopredefs.scala6
-rw-r--r--test/files/neg/viewtest.check2
6 files changed, 30 insertions, 2 deletions
diff --git a/test/files/neg/bug900.check b/test/files/neg/bug900.check
new file mode 100644
index 0000000000..531ac5bee4
--- /dev/null
+++ b/test/files/neg/bug900.check
@@ -0,0 +1,10 @@
+bug900.scala:4: error: type mismatch;
+ found : Foo.this.x.type (with underlying type Foo.this.bar)
+ required: java.lang.Object
+Note that implicit conversions are not applicable because they are ambiguous:
+ both method any2stringadd in object Predef of type (scala.Any)scala.runtime.StringAdd
+ and method any2ArrowAssoc in object Predef of type [a](a)scala.Predef.ArrowAssoc[a]
+ are possible conversion functions from Foo.this.x.type to java.lang.Object
+ def break(): x.type
+ ^
+one error found
diff --git a/test/files/neg/bug900.scala b/test/files/neg/bug900.scala
new file mode 100644
index 0000000000..2d2c857575
--- /dev/null
+++ b/test/files/neg/bug900.scala
@@ -0,0 +1,5 @@
+trait Foo {
+ type bar
+ val x : bar
+ def break(): x.type
+}
diff --git a/test/files/neg/implicits.check b/test/files/neg/implicits.check
index 9f9f7f1ced..266d92c765 100644
--- a/test/files/neg/implicits.check
+++ b/test/files/neg/implicits.check
@@ -1,4 +1,7 @@
-implicits.scala:21: error: ambiguous implicit value:
+implicits.scala:21: error: type mismatch;
+ found : Pos
+ required: ?{val +: ?}
+Note that implicit conversions are not applicable because they are ambiguous:
most specific definition is: method pos2int in object Super of type (Pos)scala.Int
yet alternative definition method any2plus in object Sub of type (scala.Any)Sub.Plus
is defined in a subclass.
diff --git a/test/files/neg/nopredefs.check b/test/files/neg/nopredefs.check
new file mode 100644
index 0000000000..0a0ab34482
--- /dev/null
+++ b/test/files/neg/nopredefs.check
@@ -0,0 +1,4 @@
+nopredefs.scala:5: error: not found: value Set
+ val y = Set(3)
+ ^
+one error found
diff --git a/test/files/neg/nopredefs.scala b/test/files/neg/nopredefs.scala
new file mode 100644
index 0000000000..1128b18934
--- /dev/null
+++ b/test/files/neg/nopredefs.scala
@@ -0,0 +1,6 @@
+import Predef.{Set => _, _}
+
+object Test {
+ val x = Map(1 -> 2)
+ val y = Set(3)
+}
diff --git a/test/files/neg/viewtest.check b/test/files/neg/viewtest.check
index d84d03fe24..2b1b2c4cbc 100644
--- a/test/files/neg/viewtest.check
+++ b/test/files/neg/viewtest.check
@@ -3,7 +3,7 @@ viewtest.scala:43: error: type mismatch;
required: scala.List[a(in method view3)]
case y1: List[a] => compareLists(x, y1)
^
-viewtest.scala:104: error: ambiguous implicit value:
+viewtest.scala:104: error: ambiguous implicit values:
both method view4 in object O of type [a](a)a
and method identity in object Predef of type [a](a)a
match expected type (test.Str) => test.Ordered[test.Str]