diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2016-03-17 11:56:14 -0700 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2016-03-26 22:54:10 -0700 |
commit | f922f367d58b3ba6bbb4cb0864ce82c5cd6f7966 (patch) | |
tree | 18a9cf588cd9e6dbe0a3815258f4dede2af3c772 /test/files/pos/sammy_overload.scala | |
parent | 040c0434d456dd75a174147d8a0c4cab37266ba6 (diff) | |
download | scala-f922f367d58b3ba6bbb4cb0864ce82c5cd6f7966.tar.gz scala-f922f367d58b3ba6bbb4cb0864ce82c5cd6f7966.tar.bz2 scala-f922f367d58b3ba6bbb4cb0864ce82c5cd6f7966.zip |
Additional SAM restrictions identified by Jason
Also test roundtripping serialization of a lambda that targets a
SAM that's not FunctionN (it should make no difference).
Diffstat (limited to 'test/files/pos/sammy_overload.scala')
-rw-r--r-- | test/files/pos/sammy_overload.scala | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/test/files/pos/sammy_overload.scala b/test/files/pos/sammy_overload.scala index 5472248f4d..6a3c88ec55 100644 --- a/test/files/pos/sammy_overload.scala +++ b/test/files/pos/sammy_overload.scala @@ -6,4 +6,29 @@ object Test { def foo(x: String): Unit = ??? def foo(): Unit = ??? val f: Consumer[_ >: String] = foo -}
\ No newline at end of file +} + +trait A[A, B] { def apply(a: A): B } + +class ArityDisambiguate { + object O { + def m(a: A[Int, Int]) = 0 + def m(f: (Int, Int) => Int) = 1 + } + + O.m(x => x) // ok + O.m((x, y) => x) // ok +} + +class InteractionWithImplicits { + object O { + class Ev + implicit object E1 extends Ev + implicit object E2 extends Ev + def m(a: A[Int, Int])(implicit ol: E1.type) = 0 + def m(a: A[String, Int])(implicit ol: E2.type) = 1 + } + + O.m((x: Int) => 1) // ok + O.m((x: String) => 1) // ok +} |