summaryrefslogtreecommitdiff
path: root/test/files/pos
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/pos')
-rw-r--r--test/files/pos/bug115.scala4
-rwxr-xr-xtest/files/pos/bug628.scala17
-rw-r--r--test/files/pos/lambda.scala9
3 files changed, 24 insertions, 6 deletions
diff --git a/test/files/pos/bug115.scala b/test/files/pos/bug115.scala
index a250e3c090..ad6cb44497 100644
--- a/test/files/pos/bug115.scala
+++ b/test/files/pos/bug115.scala
@@ -1,9 +1,9 @@
class S[A](f: A => A, x: A) {
System.out.println(f(x));
}
-class T[B](f: B => B, y: B) extends S(x: B => f(x), y) {
+class T[B](f: B => B, y: B) extends S((x: B) => f(x), y) {
}
object Test extends Application {
new T[Int](x => x * 2, 1);
- val f = new S(x: Int => x, 1);
+ val f = new S((x: Int) => x, 1);
}
diff --git a/test/files/pos/bug628.scala b/test/files/pos/bug628.scala
new file mode 100755
index 0000000000..f32c1cad0f
--- /dev/null
+++ b/test/files/pos/bug628.scala
@@ -0,0 +1,17 @@
+object Test {
+ abstract class Unit
+ object NoUnit extends Unit
+ object Hour extends Unit
+
+ case class Measure(scalar: Double, unit: Unit) {
+ def *(newUnit: Unit): Measure = Measure(scalar, newUnit)
+ }
+
+ implicit def double2Measure(scalar: Double) =
+ Measure(scalar, NoUnit)
+
+
+ def main(args: Array[String]): scala.Unit = {
+ Console.println("3.0 * Hour = " + (3.0 * (Hour: Unit)))
+ }
+}
diff --git a/test/files/pos/lambda.scala b/test/files/pos/lambda.scala
index 187b3f9783..c9094992e8 100644
--- a/test/files/pos/lambda.scala
+++ b/test/files/pos/lambda.scala
@@ -1,8 +1,9 @@
object test {
- def apply[a,b](f: a => b): a => b = x: a => f(x);
+ def apply[a,b](f: a => b): a => b = { x: a => f(x) }
- def twice[a](f: a => a): a => a = x: a => f(f(x));
+ def twice[a](f: a => a): a => a = { x: a => f(f(x)) }
+
+ def main = apply[Int,Int](twice[Int]{x: Int => x})(1);
+}
- def main = apply[Int,Int](twice[Int](x: Int => x))(1);
-} \ No newline at end of file