diff options
author | James Iry <james.iry@typesafe.com> | 2013-08-28 20:48:47 -0700 |
---|---|---|
committer | James Iry <james.iry@typesafe.com> | 2013-11-06 12:28:20 -0800 |
commit | 13ea5909ea25e4bad184e9e4581d94230dc11d9f (patch) | |
tree | 9e7ccbe84eeb38c7f0e6d897e40b57fb05e1d040 /test/files/specialized/constant_lambda.scala | |
parent | f27f2d80d759130597b652d6cc9d789f8c472e5a (diff) | |
download | scala-13ea5909ea25e4bad184e9e4581d94230dc11d9f.tar.gz scala-13ea5909ea25e4bad184e9e4581d94230dc11d9f.tar.bz2 scala-13ea5909ea25e4bad184e9e4581d94230dc11d9f.zip |
Make specialization aware of anonymous functions.
During development of late delmabdafying there was a problem where
specialization would undo some of the work done in uncurry if the body
of the lambda had a constant type. That would result in a compiler crash
as when the delambdafy phase got a tree shape it didn't understand.
This commit has a fix and a test.
Diffstat (limited to 'test/files/specialized/constant_lambda.scala')
-rw-r--r-- | test/files/specialized/constant_lambda.scala | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/files/specialized/constant_lambda.scala b/test/files/specialized/constant_lambda.scala new file mode 100644 index 0000000000..bb9a97403e --- /dev/null +++ b/test/files/specialized/constant_lambda.scala @@ -0,0 +1,16 @@ +// during development of late delmabdafying there was a problem where +// specialization would undo some of the work done in uncurry if the body of the +// lambda had a constant type. That would result in a compiler crash as +// when the delambdafy phase got a tree shape it didn't understand +class X[@specialized(Int) A] { + val f = { x: A => false } +} + +object Test { + def main(args: Array[String]) { + val xInt = new X[Int] + println(xInt.f(42)) + val xString = new X[String] + println(xString.f("hello")) + } +}
\ No newline at end of file |