summaryrefslogtreecommitdiff
path: root/test/files/pos
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/pos')
-rw-r--r--test/files/pos/sam_ctor_arg.scala4
-rw-r--r--test/files/pos/sam_infer_argtype_subtypes.scala6
-rw-r--r--test/files/pos/sam_inferargs.scala6
-rw-r--r--test/files/pos/sammy_implicit.scala10
-rw-r--r--test/files/pos/t8429.scala7
5 files changed, 33 insertions, 0 deletions
diff --git a/test/files/pos/sam_ctor_arg.scala b/test/files/pos/sam_ctor_arg.scala
new file mode 100644
index 0000000000..3c556d59f0
--- /dev/null
+++ b/test/files/pos/sam_ctor_arg.scala
@@ -0,0 +1,4 @@
+trait Fun[A, B] { def apply(a: A): B }
+// can't do sam expansion until the sam body def is a static method in the sam class, and not a local method in a block'
+class C(f: Fun[Int, String])
+class Test extends C(s => "a") \ No newline at end of file
diff --git a/test/files/pos/sam_infer_argtype_subtypes.scala b/test/files/pos/sam_infer_argtype_subtypes.scala
new file mode 100644
index 0000000000..63966f879e
--- /dev/null
+++ b/test/files/pos/sam_infer_argtype_subtypes.scala
@@ -0,0 +1,6 @@
+trait Fun[A, B] { def apply(a: A): B }
+
+class SamInferResult {
+ def foreach[U](f: Fun[String, U]): U = ???
+ def foo = foreach(println)
+} \ No newline at end of file
diff --git a/test/files/pos/sam_inferargs.scala b/test/files/pos/sam_inferargs.scala
new file mode 100644
index 0000000000..10d9b4f0dd
--- /dev/null
+++ b/test/files/pos/sam_inferargs.scala
@@ -0,0 +1,6 @@
+trait Proc { def apply(): Unit }
+class Test {
+ val initCode = List[Proc]()
+ initCode foreach { proc => proc() }
+
+}
diff --git a/test/files/pos/sammy_implicit.scala b/test/files/pos/sammy_implicit.scala
new file mode 100644
index 0000000000..c9c2519bab
--- /dev/null
+++ b/test/files/pos/sammy_implicit.scala
@@ -0,0 +1,10 @@
+abstract class SamImplicitConvert {
+ trait Fun[A, B] { def apply(a: A): B }
+ class Lst[T]
+ abstract class Str { def getBytes: Array[Int] }
+ def flatMap[B](f: Fun[Str, Lst[B]]): List[B] = ???
+
+ implicit def conv(xs: Array[Int]): Lst[Int]
+
+ val encoded = flatMap (_.getBytes)
+}
diff --git a/test/files/pos/t8429.scala b/test/files/pos/t8429.scala
new file mode 100644
index 0000000000..a2d32637e1
--- /dev/null
+++ b/test/files/pos/t8429.scala
@@ -0,0 +1,7 @@
+trait Must { def musta(str: String, i: Int): Unit }
+
+object Mustare {
+ def takesM(m: Must) = ???
+ takesM{ (a, b) => println } // ok
+ takesM{ case (a: String, b: Int) => println("") } // should also be accepted
+}