From 23904f63552d7cb98865d5a07101e2e9795d2ad1 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Wed, 31 May 2006 09:47:38 +0000 Subject: fixed bugs 616, 617 --- test/files/neg/bug126.scala | 8 ++++++++ test/files/pos/bug122.scala | 4 ++++ test/files/pos/bug616.scala | 11 +++++++++++ test/files/run/bug216.scala | 7 +++++++ test/files/run/lisp.scala | 14 ++++++-------- 5 files changed, 36 insertions(+), 8 deletions(-) create mode 100755 test/files/neg/bug126.scala create mode 100755 test/files/pos/bug122.scala create mode 100644 test/files/pos/bug616.scala create mode 100644 test/files/run/bug216.scala (limited to 'test/files') 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") } -- cgit v1.2.3