summaryrefslogtreecommitdiff
path: root/test/files
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2006-05-31 09:47:38 +0000
committerMartin Odersky <odersky@gmail.com>2006-05-31 09:47:38 +0000
commit23904f63552d7cb98865d5a07101e2e9795d2ad1 (patch)
tree897cd8dfd243c5921570ebd1c091c111cf146d5a /test/files
parentcab784ad14708b1c2b95d8af44b20f802667e7b2 (diff)
downloadscala-23904f63552d7cb98865d5a07101e2e9795d2ad1.tar.gz
scala-23904f63552d7cb98865d5a07101e2e9795d2ad1.tar.bz2
scala-23904f63552d7cb98865d5a07101e2e9795d2ad1.zip
fixed bugs 616, 617
Diffstat (limited to 'test/files')
-rwxr-xr-xtest/files/neg/bug126.scala8
-rwxr-xr-xtest/files/pos/bug122.scala4
-rw-r--r--test/files/pos/bug616.scala11
-rw-r--r--test/files/run/bug216.scala7
-rw-r--r--test/files/run/lisp.scala14
5 files changed, 36 insertions, 8 deletions
diff --git a/test/files/neg/bug126.scala b/test/files/neg/bug126.scala
new file mode 100755
index 0000000000..75c10e608a
--- /dev/null
+++ b/test/files/neg/bug126.scala
@@ -0,0 +1,8 @@
+class O {
+ val Bar:Any => Any = ((x:Any) => Bar(x));
+ val Tuple2(foo:(Any => Any), bar) = Tuple2((x:Any) => foo(x), 1);
+ {
+ val Tuple1(foo2:(Any => Any)) = Tuple1((x:Any) => foo2(x));
+ Console.println(foo2)
+ }
+}
diff --git a/test/files/pos/bug122.scala b/test/files/pos/bug122.scala
new file mode 100755
index 0000000000..cbfdb64def
--- /dev/null
+++ b/test/files/pos/bug122.scala
@@ -0,0 +1,4 @@
+class L{
+ val List(v:int,2) = List(2,v:int);
+ val Pair(a:int,b:int) = Pair(1,a);
+} \ No newline at end of file
diff --git a/test/files/pos/bug616.scala b/test/files/pos/bug616.scala
new file mode 100644
index 0000000000..bf757a58d3
--- /dev/null
+++ b/test/files/pos/bug616.scala
@@ -0,0 +1,11 @@
+object testImplicit {
+ implicit def foo2bar(foo :Foo) :Bar = foo.bar
+ class Foo(val bar :Bar) {
+ def testCoercion = {val a = this; a.baz} // here, foo2bar is inferred by the compiler, as expected
+ //def testCoercionThisImplicit = baz // --> error: not found: value baz
+ def testCoercionThisExplicit: Any = this.baz // --> error: value baz is not a member of Foo
+ }
+ trait Bar { def baz :unit}
+}
+// mentioned before: http://thread.gmane.org/gmane.comp.lang.scala/2038,
+// but couldn't find a bug report
diff --git a/test/files/run/bug216.scala b/test/files/run/bug216.scala
new file mode 100644
index 0000000000..41b2af7b50
--- /dev/null
+++ b/test/files/run/bug216.scala
@@ -0,0 +1,7 @@
+object Test extends Application {
+ object m {
+ val f = x: unit => ();
+ Console.println("OK")
+ }
+ m;
+}
diff --git a/test/files/run/lisp.scala b/test/files/run/lisp.scala
index 34c4e7c7cc..cb26972e2d 100644
--- a/test/files/run/lisp.scala
+++ b/test/files/run/lisp.scala
@@ -15,14 +15,12 @@ class LispTokenizer(s: String) extends Iterator[String] {
}
def next: String =
if (hasNext) {
- val start = i;
- var ch = s.charAt(i); i = i + 1;
- if (ch == '(') "("
- else if (ch == ')') ")"
- else {
- while (i < s.length() && !isDelimiter(s.charAt(i))){ i = i + 1 }
- s.substring(start, i)
- }
+ val start = i
+ if (isDelimiter(s charAt i)) i = i + 1
+ else
+ do i = i + 1
+ while (!isDelimiter(s charAt i))
+ s.substring(start, i)
} else error("premature end of string")
}