From d492b489b176a3d2a4da0d199756af86514be352 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Mon, 28 Jul 2008 10:00:31 +0000 Subject: fixed #842, #945, #83, #996, #1016, + some perf... fixed #842, #945, #83, #996, #1016, + some performace tuning. --- test/files/neg/t0764.check | 2 +- test/files/neg/t0842.check | 4 ++++ test/files/neg/t0842.scala | 1 + test/files/pos/t0872.scala | 8 ++++++++ test/pending/pos/t0756.scala | 8 ++++++++ test/pending/pos/t0774/unrelated.scala | 9 +++++++++ test/pending/pos/t0805.scala | 9 +++++++++ test/pending/run/t0508x.scala | 21 +++++++++++++++++++++ test/pending/run/t0818.scala | 4 ++++ 9 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 test/files/neg/t0842.check create mode 100755 test/files/neg/t0842.scala create mode 100755 test/files/pos/t0872.scala create mode 100644 test/pending/pos/t0756.scala create mode 100644 test/pending/pos/t0774/unrelated.scala create mode 100644 test/pending/pos/t0805.scala create mode 100755 test/pending/run/t0508x.scala create mode 100644 test/pending/run/t0818.scala (limited to 'test') diff --git a/test/files/neg/t0764.check b/test/files/neg/t0764.check index b622f17c5e..9f0cedc69b 100644 --- a/test/files/neg/t0764.check +++ b/test/files/neg/t0764.check @@ -1,5 +1,5 @@ t0764.scala:13: error: type mismatch; - found : java.lang.Object with Node{type T = _1.type} where val _1: Main.this.AType + found : java.lang.Object with Node{type T = _1.type} where val _1: Node{type T = NextType} required: Node{type T = Main.this.AType} new Main[AType]( (value: AType).prepend ) ^ diff --git a/test/files/neg/t0842.check b/test/files/neg/t0842.check new file mode 100644 index 0000000000..5f88f08194 --- /dev/null +++ b/test/files/neg/t0842.check @@ -0,0 +1,4 @@ +t0842.scala:1: error: A.this.type does not take type parameters +trait A[T] { def m: this.type[T] = this } + ^ +one error found diff --git a/test/files/neg/t0842.scala b/test/files/neg/t0842.scala new file mode 100755 index 0000000000..f32c2ba26d --- /dev/null +++ b/test/files/neg/t0842.scala @@ -0,0 +1 @@ +trait A[T] { def m: this.type[T] = this } diff --git a/test/files/pos/t0872.scala b/test/files/pos/t0872.scala new file mode 100755 index 0000000000..8f4c1c4436 --- /dev/null +++ b/test/files/pos/t0872.scala @@ -0,0 +1,8 @@ +object Main { + def main(args : Array[String]) { + val fn = (a : Int, str : String) => "a: " + a + ", str: " + str + implicit def fx[T](f : (T,String) => String) = (x:T) => f(x,null) + println(fn(1)) + () + } +} diff --git a/test/pending/pos/t0756.scala b/test/pending/pos/t0756.scala new file mode 100644 index 0000000000..a778bd63d0 --- /dev/null +++ b/test/pending/pos/t0756.scala @@ -0,0 +1,8 @@ +object Test { + for { + n <- Some(42) + + _ + m <- Some(24) + } yield n +} diff --git a/test/pending/pos/t0774/unrelated.scala b/test/pending/pos/t0774/unrelated.scala new file mode 100644 index 0000000000..1efdb2505e --- /dev/null +++ b/test/pending/pos/t0774/unrelated.scala @@ -0,0 +1,9 @@ +object Outer { + import Inner._ + + deathname + + object Inner { + def deathname: Int = 1 + } +} diff --git a/test/pending/pos/t0805.scala b/test/pending/pos/t0805.scala new file mode 100644 index 0000000000..565a2a6527 --- /dev/null +++ b/test/pending/pos/t0805.scala @@ -0,0 +1,9 @@ +package fr.up5.mi.noel.scala +object Test { + def make(t: Test) : Test = TestList(t.args.toList) +} +case class TestList[T](elements: List[T])(implicit f: T => Test) + +class Test { + val args: Array[Test] +} diff --git a/test/pending/run/t0508x.scala b/test/pending/run/t0508x.scala new file mode 100755 index 0000000000..0c1ffde3ed --- /dev/null +++ b/test/pending/run/t0508x.scala @@ -0,0 +1,21 @@ + final object Test extends java.lang.Object with Application { + + class Foo(val s: String, val n: Int) extends java.lang.Object { + }; + + def foo[A >: Nothing <: Any, B >: Nothing <: Any, C >: Nothing <: Any] + (unapply1: (A) => Option[(B, C)], v: A): Unit = + unapply1.apply(v) match { + case Some((fst @ _, snd @ _)) => + scala.Predef.println(scala.Tuple2.apply[java.lang.String, java.lang.String]("first: ".+(fst), " second: ".+(snd))) + case _ => scala.Predef.println(":(") + } + Test.this.foo[Test.Foo, String, Int]({ + ((eta$0$1: Test.Foo) => Test.this.Foo.unapply(eta$0$1)) + }, Test.this.Foo.apply("this might be fun", 10)); + final object Foo extends java.lang.Object with ((String, Int) => Test.Foo) { + def unapply(x$0: Test.Foo): Some[(String, Int)] = scala.Some.apply[(String, Int)](scala.Tuple2.apply[String, Int](x$0.s, x$0.n)); + def apply(s: String, n: Int): Test.Foo = new Test.this.Foo(s, n) + } + } + diff --git a/test/pending/run/t0818.scala b/test/pending/run/t0818.scala new file mode 100644 index 0000000000..677b85d920 --- /dev/null +++ b/test/pending/run/t0818.scala @@ -0,0 +1,4 @@ +object Seth extends Application { + println( + new java.util.ArrayList[String]().toArray(Array[String]())) +} -- cgit v1.2.3