Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

SI-7406 crasher with specialized lazy val

This reverts a tiny bit of f7d5f45 where the crasher was
introduced. The enclosed test case compiles and runs under 2.9,
but prints the wrong answer. It crashes in 2.10 and until this
patch. Now it compiles and prints the right answer.
  • Loading branch information...
commit 72cd50c11b17da19c8b95265503d5aa6e7bd81eb 1 parent 9f0594c
@paulp paulp authored
View
2  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)
View
1  test/files/run/t7406.check
@@ -0,0 +1 @@
+10
View
14 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)
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.