summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala2
-rw-r--r--test/files/run/t7406.check1
-rw-r--r--test/files/run/t7406.scala14
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)
+ }
+}