diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-11-07 10:56:47 -0800 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-11-07 10:56:47 -0800 |
commit | e72c11e18062b4e281cc38fb7727b3bd144c8594 (patch) | |
tree | c73549ee81ec9aacab999fc68673133940d5ae26 /test/files/neg/delambdafy_t6260_method.scala | |
parent | bb02fb350f7ec4aefcc830fec36a964ae45cfdd4 (diff) | |
parent | ef995ac6b4030e3cd10e487d414c941e5794666f (diff) | |
download | scala-e72c11e18062b4e281cc38fb7727b3bd144c8594.tar.gz scala-e72c11e18062b4e281cc38fb7727b3bd144c8594.tar.bz2 scala-e72c11e18062b4e281cc38fb7727b3bd144c8594.zip |
Merge pull request #3081 from JamesIry/wip_delayed_delambdafy_cleanup
Delay delambdafication and put the lambda's body into the containing class
Diffstat (limited to 'test/files/neg/delambdafy_t6260_method.scala')
-rw-r--r-- | test/files/neg/delambdafy_t6260_method.scala | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/files/neg/delambdafy_t6260_method.scala b/test/files/neg/delambdafy_t6260_method.scala new file mode 100644 index 0000000000..93b5448227 --- /dev/null +++ b/test/files/neg/delambdafy_t6260_method.scala @@ -0,0 +1,17 @@ +class Box[X](val x: X) extends AnyVal { + def map[Y](f: X => Y): Box[Y] = + ((bx: Box[X]) => new Box(f(bx.x)))(this) +} + +object Test { + def map2[X, Y](self: Box[X], f: X => Y): Box[Y] = + ((bx: Box[X]) => new Box(f(bx.x)))(self) + + def main(args: Array[String]) { + val f = (x: Int) => x + 1 + val g = (x: String) => x + x + + map2(new Box(42), f) + new Box("abc") map g + } +} |