diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-12-31 06:51:51 -0800 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2013-12-31 06:51:51 -0800 |
commit | b2bf66a4681dec76281da9469e66e0100ad2709f (patch) | |
tree | 311fda392459e96e40b37461bc3d5e531703d37f | |
parent | fbbe7cc1773fad2b261f65b1381f94532d252f6f (diff) | |
parent | 72cd50c11b17da19c8b95265503d5aa6e7bd81eb (diff) | |
download | scala-b2bf66a4681dec76281da9469e66e0100ad2709f.tar.gz scala-b2bf66a4681dec76281da9469e66e0100ad2709f.tar.bz2 scala-b2bf66a4681dec76281da9469e66e0100ad2709f.zip |
Merge pull request #3297 from paulp/pr/7406
crasher with specialized lazy val
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala | 2 | ||||
-rw-r--r-- | test/files/run/t7406.check | 1 | ||||
-rw-r--r-- | test/files/run/t7406.scala | 14 |
3 files changed, 16 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala index 1723c69180..c505d9dc5f 100644 --- a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala +++ b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala @@ -923,7 +923,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { /** Return the specialized overload of `m`, in the given environment. */ private def specializedOverload(owner: Symbol, sym: Symbol, env: TypeEnv, nameSymbol: Symbol = NoSymbol): Symbol = { - val newFlags = (sym.flags | SPECIALIZED) & ~(DEFERRED | CASEACCESSOR) + val newFlags = (sym.flags | SPECIALIZED) & ~(DEFERRED | CASEACCESSOR | LAZY) // this method properly duplicates the symbol's info val specname = specializedName(nameSymbol orElse sym, env) ( sym.cloneSymbol(owner, newFlags, newName = specname) diff --git a/test/files/run/t7406.check b/test/files/run/t7406.check new file mode 100644 index 0000000000..f599e28b8a --- /dev/null +++ b/test/files/run/t7406.check @@ -0,0 +1 @@ +10 diff --git a/test/files/run/t7406.scala b/test/files/run/t7406.scala new file mode 100644 index 0000000000..a8b35c91c9 --- /dev/null +++ b/test/files/run/t7406.scala @@ -0,0 +1,14 @@ +class Arne[@specialized(Long) T](x: T) { + val regularVal = x + lazy val lazyVal = x + + def apply(f: (T, T) => T): T = f(regularVal, lazyVal) +} + +object Test { + val arne = new Arne(5L) + def f = arne(_ + _) + def main(args: Array[String]): Unit = { + println(f) + } +} |