我的期货构成"似乎已经杀了编译器"

时间:2015-03-06 19:54:42

标签: scala

我正在玩期货中的副作用,并且从Scala编译器(2.11.1)中获得了我见过的最奇怪的堆栈跟踪。有谁知道这里会发生什么?

scala> import scala.concurrent._; import ExecutionContext.Implicits._
scala> var sum = 0; Future{Thread.sleep(1000); sum += 23} andThen Future{Thread.sleep(1000); sum += 7}

java.lang.AssertionError: assertion failed: 
  Future({
  Thread.sleep(1000);
  sum.<$plus$eq: error>(7)
})
     while compiling: <console>
        during phase: superaccessors
     library version: version 2.11.1
    compiler version: version 2.11.1
  reconstructed args: 

  last tree to typer: This(object $iw)
       tree position: line 15 of <console>
            tree tpe: $line29.$read.$iw.$iw.$iw.$iw.$iw.$iw.type
              symbol: object $iw
   symbol definition: class $iw extends AnyRef (a ModuleClassSymbol)
      symbol package: $line29
       symbol owners: object $iw -> object $iw -> object $iw -> object $iw ->    object $iw -> object $iw -> object $read
           call site: object $iw in package $line29

<Cannot read source file>
    at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer.transform(SuperAcc essors.scala:320)
    at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer$$anonfun$transform Args$1.apply(SuperAccessors.scala:86)
    at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer$$anonfun$transformArgs$1.apply(SuperAccessors.scala:83)
    at scala.reflect.internal.TreeInfo$$anonfun$mapMethodParamsAndArgs$1.apply(TreeInfo.scala:231)
    at scala.reflect.internal.TreeInfo$$anonfun$mapMethodParamsAndArgs$1.apply(TreeInfo.scala:231)
    at scala.reflect.internal.util.Collections$class.foreach2(Collections.scala:218)
    at scala.reflect.internal.SymbolTable.foreach2(SymbolTable.scala:16)
...
That entry seems to have slain the compiler.  Shall I replay
your session? I can re-run each line except the last one.
[y/n]
Abandoning crashed session.

您可以在此处查看完整堆栈跟踪:http://pastebin.com/Q85CQqDh

0 个答案:

没有答案