Scala 编译器抛出 "internal" 类型不匹配错误而不给出错误位置

Scala compiler throws "internal" type mismatch error without giving error location

我正在使用 scala 2.10.5 编译一个包含 77 个 Scala 文件的项目。

我收到 0 条警告和 1 条奇怪的错误消息:

[ERROR] type mismatch;
 found   : Array[?B]
 required: scala.collection.GenTraversableOnce[?]
Note that implicit conversions are not applicable because they are ambiguous:
 both method booleanArrayOps in object Predef of type (xs: Array[Boolean])scala.collection.mutable.ArrayOps[Boolean]
 and method byteArrayOps in object Predef of type (xs: Array[Byte])scala.collection.mutable.ArrayOps[Byte]
 are possible conversion functions from Array[?B] to scala.collection.GenTraversableOnce[?]
[ERROR] one error found
[INFO] ------------------ ....{this line is irrelevant}

错误信息没有指明错误位置,所以我认为这是一个scalac内部错误。我应该如何调试它?

非常感谢您的帮助。

更新:我启用了调试模式并查看了完整的堆栈跟踪:

Caused by: Compilation failed
        at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:105)
        at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:48)
        at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:41)
        at sbt.compiler.AggressiveCompile$$anonfun$$anonfun$compileScala.apply$mcV$sp(AggressiveCompile.scala:99)
        at sbt.compiler.AggressiveCompile$$anonfun$$anonfun$compileScala.apply(AggressiveCompile.scala:99)
        at sbt.compiler.AggressiveCompile$$anonfun$$anonfun$compileScala.apply(AggressiveCompile.scala:99)
        at sbt.compiler.AggressiveCompile.sbt$compiler$AggressiveCompile$$timed(AggressiveCompile.scala:166)
        at sbt.compiler.AggressiveCompile$$anonfun.compileScala(AggressiveCompile.scala:98)
        at sbt.compiler.AggressiveCompile$$anonfun.apply(AggressiveCompile.scala:143)
        at sbt.compiler.AggressiveCompile$$anonfun.apply(AggressiveCompile.scala:87)
        at sbt.inc.IncrementalCompile$$anonfun$doCompile.apply(Compile.scala:39)
        at sbt.inc.IncrementalCompile$$anonfun$doCompile.apply(Compile.scala:37)
        at sbt.inc.IncrementalCommon.cycle(Incremental.scala:99)
        at sbt.inc.Incremental$$anonfun.apply(Incremental.scala:38)
        at sbt.inc.Incremental$$anonfun.apply(Incremental.scala:37)
        at sbt.inc.Incremental$.manageClassfiles(Incremental.scala:65)
        at sbt.inc.Incremental$.compile(Incremental.scala:37)
        at sbt.inc.IncrementalCompile$.apply(Compile.scala:27)
        at sbt.compiler.AggressiveCompile.compile2(AggressiveCompile.scala:157)
        at sbt.compiler.AggressiveCompile.compile1(AggressiveCompile.scala:71)
        at com.typesafe.zinc.Compiler.compile(Compiler.scala:184)
        at com.typesafe.zinc.Compiler.compile(Compiler.scala:164)
        at sbt_inc.SbtIncrementalCompiler.compile(SbtIncrementalCompiler.java:92)
        at scala_maven.ScalaCompilerSupport.incrementalCompile(ScalaCompilerSupport.java:303)
        at scala_maven.ScalaCompilerSupport.compile(ScalaCompilerSupport.java:119)
        at scala_maven.ScalaCompilerSupport.doExecute(ScalaCompilerSupport.java:99)
        at scala_maven.ScalaMojoSupport.execute(ScalaMojoSupport.java:482)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        ... 21 more

这对确定问题有帮助吗?

好的,我找到了解决方案:

scalac 2.10.5 在打印出错误的行号时出现故障,这确实是我代码中的语法错误。

当我切换到 scalac 2.11.7 时,行号被打印出来,这使得修复问题变得容易