断言失败:/断言中的接口无效:ClassBType.info 尚未分配
Assertion failed: Invalid interfaces in / assertion failed: ClassBType.info not yet assigned
我在编译我的测试部分时遇到了这两个错误,不幸的是我试图找到解决这些问题的任何提示都失败了。
我尝试清理,从头开始重建,但没有成功。我在有和没有我的想法的情况下进行了编译,结果相同。
我正在使用 scala 2.12.12 和 sbt 1.5。
在我的研究过程中,我读了一些可能 link 到 java/scala 导入歧义的东西(https://github.com/scala/bug/issues/9111),但我没有 java 导入。
这是我的 scalac 选项:
scalacOptions ++= Seq(
"-unchecked",
"-deprecation",
"-feature",
"-language:higherKinds",
"-language:implicitConversions",
"-language:existentials",
"-Ypartial-unification",
),
当我遇到它们时的情况是当我询问特定 class 的通用类型时,我们称之为 Toto。例如,如果我这样写:
trait Test[
A, // Everything is OK
MyClass <: Toto[A] // Problem !
] {
def toto: Toto[Int] // Problem !
}
我试图重现我的问题,但是当我完全复制 classes 时,它们的层次结构。使用我复制的示例在测试中一切正常...
这里是完整的堆栈跟踪:
java.lang.AssertionError: assertion failed: Invalid interfaces in Lcom/XXX/TraitName;: List(Lcom/XXX;)
| => cat scala.tools.nsc.backend.jvm.BTypes$ClassBType.scala$tools$nsc$backend$jvm$BTypes$ClassBType$$checkInfoConsistency(BTypes.scala:644)
at scala.tools.nsc.backend.jvm.BTypes$ClassBType$.apply(BTypes.scala:826)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.classBTypeFromSymbol(BTypesFromSymbols.scala:105)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.$anonfun$computeClassInfo(BTypesFromSymbols.scala:331)
at scala.collection.immutable.List.map(List.scala:293)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.computeClassInfo(BTypesFromSymbols.scala:331)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.$anonfun$classBTypeFromSymbol(BTypesFromSymbols.scala:108)
at scala.tools.nsc.backend.jvm.BTypes$ClassBType$.apply(BTypes.scala:825)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.classBTypeFromSymbol(BTypesFromSymbols.scala:105)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.$anonfun$computeClassInfo(BTypesFromSymbols.scala:331)
at scala.collection.immutable.List.map(List.scala:293)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.computeClassInfo(BTypesFromSymbols.scala:331)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.$anonfun$classBTypeFromSymbol(BTypesFromSymbols.scala:108)
at scala.tools.nsc.backend.jvm.BTypes$ClassBType$.apply(BTypes.scala:825)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.classBTypeFromSymbol(BTypesFromSymbols.scala:105)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.$anonfun$computeClassInfo(BTypesFromSymbols.scala:331)
at scala.collection.immutable.List.map(List.scala:293)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.computeClassInfo(BTypesFromSymbols.scala:331)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.$anonfun$classBTypeFromSymbol(BTypesFromSymbols.scala:108)
at scala.tools.nsc.backend.jvm.BTypes$ClassBType$.apply(BTypes.scala:825)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.classBTypeFromSymbol(BTypesFromSymbols.scala:105)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.$anonfun$computeClassInfo(BTypesFromSymbols.scala:331)
at scala.collection.immutable.List.map(List.scala:293)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.computeClassInfo(BTypesFromSymbols.scala:331)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.$anonfun$classBTypeFromSymbol(BTypesFromSymbols.scala:108)
at scala.tools.nsc.backend.jvm.BTypes$ClassBType$.apply(BTypes.scala:825)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.classBTypeFromSymbol(BTypesFromSymbols.scala:105)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.$anonfun$typeToBType(BTypesFromSymbols.scala:163)
at scala.collection.immutable.HashMap$HashMap1.getOrElse0(HashMap.scala:355)
at scala.collection.immutable.HashMap$HashTrieMap.getOrElse0(HashMap.scala:587)
at scala.collection.immutable.HashMap.getOrElse(HashMap.scala:72)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.primitiveOrClassToBType(BTypesFromSymbols.scala:163)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.typeToBType(BTypesFromSymbols.scala:178)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.methodBTypeFromMethodType(BTypesFromSymbols.scala:127)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.methodBTypeFromSymbol(BTypesFromSymbols.scala:118)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.$anonfun$buildInlineInfoFromClassSymbol(BTypesFromSymbols.scala:585)
at scala.collection.Iterator$$anon.nextCur(Iterator.scala:486)
at scala.collection.Iterator$$anon.hasNext(Iterator.scala:492)
at scala.collection.Iterator.foreach(Iterator.scala:943)
at scala.collection.Iterator.foreach$(Iterator.scala:943)
at scala.collection.AbstractIterator.foreach(Iterator.scala:1431)
at scala.collection.generic.Growable.$plus$plus$eq(Growable.scala:62)
at scala.collection.generic.Growable.$plus$plus$eq$(Growable.scala:53)
at scala.collection.immutable.Map$MapBuilderImpl.$plus$plus$eq(Map.scala:583)
at scala.collection.immutable.Map$MapBuilderImpl.$plus$plus$eq(Map.scala:533)
at scala.collection.TraversableOnce.toMap(TraversableOnce.scala:354)
at scala.collection.TraversableOnce.toMap$(TraversableOnce.scala:352)
at scala.collection.AbstractIterator.toMap(Iterator.scala:1431)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.buildInlineInfoFromClassSymbol(BTypesFromSymbols.scala:618)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.buildInlineInfo(BTypesFromSymbols.scala:522)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.computeClassInfo(BTypesFromSymbols.scala:441)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.$anonfun$classBTypeFromSymbol(BTypesFromSymbols.scala:108)
at scala.tools.nsc.backend.jvm.BTypes$ClassBType$.apply(BTypes.scala:825)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.classBTypeFromSymbol(BTypesFromSymbols.scala:105)
at scala.tools.nsc.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.genPlainClass(BCodeSkelBuilder.scala:97)
at scala.tools.nsc.backend.jvm.CodeGen.genClass(CodeGen.scala:81)
at scala.tools.nsc.backend.jvm.CodeGen.genClassDef(CodeGen.scala:42)
at scala.tools.nsc.backend.jvm.CodeGen.$anonfun$genUnit(CodeGen.scala:66)
at scala.tools.nsc.backend.jvm.CodeGen.genClassDefs(CodeGen.scala:66)
at scala.tools.nsc.backend.jvm.CodeGen.$anonfun$genUnit(CodeGen.scala:65)
at scala.tools.nsc.backend.jvm.CodeGen.genClassDefs(CodeGen.scala:65)
at scala.tools.nsc.backend.jvm.CodeGen.$anonfun$genUnit(CodeGen.scala:70)
at scala.tools.nsc.backend.jvm.CodeGen.genUnit(CodeGen.scala:70)
at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase.apply(GenBCode.scala:74)
at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:454)
at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:402)
at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase.super$run(GenBCode.scala:80)
at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase.$anonfun$run(GenBCode.scala:80)
at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase.run(GenBCode.scala:78)
at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1511)
at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1495)
at scala.tools.nsc.Global$Run.compileSources(Global.scala:1488)
at scala.tools.nsc.Global$Run.compileFiles(Global.scala:1596)
at xsbt.CachedCompiler0.run(CompilerBridge.scala:163)
at xsbt.CachedCompiler0.run(CompilerBridge.scala:134)
at xsbt.CompilerBridge.run(CompilerBridge.scala:39)
at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:92)
at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile(MixedAnalyzingCompiler.scala:186)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
at sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:241)
at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile(MixedAnalyzingCompiler.scala:176)
at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$adapted(MixedAnalyzingCompiler.scala:157)
at sbt.internal.inc.JarUtils$.withPreviousJar(JarUtils.scala:239)
at sbt.internal.inc.MixedAnalyzingCompiler.compileScala(MixedAnalyzingCompiler.scala:157)
at sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:204)
at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal(IncrementalCompilerImpl.scala:573)
at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$adapted(IncrementalCompilerImpl.scala:573)
at sbt.internal.inc.Incremental$.$anonfun$apply(Incremental.scala:173)
at sbt.internal.inc.Incremental$.$anonfun$apply$adapted(Incremental.scala:171)
at sbt.internal.inc.Incremental$$anon.run(Incremental.scala:458)
at sbt.internal.inc.IncrementalCommon$CycleState.next(IncrementalCommon.scala:116)
at sbt.internal.inc.IncrementalCommon$$anon.next(IncrementalCommon.scala:56)
at sbt.internal.inc.IncrementalCommon$$anon.next(IncrementalCommon.scala:52)
at sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:261)
at sbt.internal.inc.Incremental$.$anonfun$incrementalCompile(Incremental.scala:413)
at sbt.internal.inc.Incremental$.withClassfileManager(Incremental.scala:498)
at sbt.internal.inc.Incremental$.incrementalCompile(Incremental.scala:400)
at sbt.internal.inc.Incremental$.apply(Incremental.scala:165)
at sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:573)
at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally(IncrementalCompilerImpl.scala:491)
at sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:332)
at sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:420)
at sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:137)
at sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:2176)
at sbt.Defaults$.$anonfun$compileIncrementalTask(Defaults.scala:2133)
at sbt.internal.io.Retry$.apply(Retry.scala:40)
at sbt.internal.io.Retry$.apply(Retry.scala:23)
at sbt.internal.server.BspCompileTask$.compute(BspCompileTask.scala:31)
at sbt.Defaults$.$anonfun$compileIncrementalTask(Defaults.scala:2129)
at scala.Function1.$anonfun$compose(Function1.scala:49)
at sbt.internal.util.$tilde$greater.$anonfun$$u2219(TypeFunctions.scala:62)
at sbt.std.Transform$$anon.work(Transform.scala:68)
at sbt.Execute.$anonfun$submit(Execute.scala:282)
at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23)
at sbt.Execute.work(Execute.scala:291)
at sbt.Execute.$anonfun$submit(Execute.scala:282)
at sbt.ConcurrentRestrictions$$anon.$anonfun$submitValid(ConcurrentRestrictions.scala:265)
at sbt.CompletionService$$anon.call(CompletionService.scala:64)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
java.lang.AssertionError: assertion failed: ClassBType.info not yet assigned: Lcom/xxx/Class;
| => cat scala.tools.nsc.backend.jvm.BTypes$ClassBType.info(BTypes.scala:620)
at scala.tools.nsc.backend.jvm.BTypes$ClassBType.isInterface(BTypes.scala:652)
at scala.tools.nsc.backend.jvm.BTypes$ClassBType.isSubtypeOf(BTypes.scala:707)
at scala.tools.nsc.backend.jvm.BTypes$ClassBType.$anonfun$isSubtypeOf(BTypes.scala:719)
at scala.tools.nsc.backend.jvm.BTypes$ClassBType.isSubtypeOf(BTypes.scala:719)
at scala.tools.nsc.backend.jvm.BTypes$ClassBType.$anonfun$isSubtypeOf(BTypes.scala:719)
at scala.tools.nsc.backend.jvm.BTypes$ClassBType.isSubtypeOf(BTypes.scala:719)
at scala.tools.nsc.backend.jvm.BTypes$ClassBType.$anonfun$isSubtypeOf(BTypes.scala:719)
at scala.tools.nsc.backend.jvm.BTypes$ClassBType.isSubtypeOf(BTypes.scala:719)
at scala.tools.nsc.backend.jvm.BTypes$ClassBType.$anonfun$isSubtypeOf(BTypes.scala:719)
at scala.tools.nsc.backend.jvm.BTypes$ClassBType.isSubtypeOf(BTypes.scala:719)
at scala.tools.nsc.backend.jvm.BTypes$ClassBType.$anonfun$isSubtypeOf(BTypes.scala:719)
at scala.tools.nsc.backend.jvm.BTypes$ClassBType.isSubtypeOf(BTypes.scala:719)
at scala.tools.nsc.backend.jvm.BTypes$BType.$anonfun$conformsTo(BTypes.scala:145)
at scala.tools.nsc.backend.jvm.BTypes$BType.conformsTo(BTypes.scala:118)
at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.adapt(BCodeBodyBuilder.scala:831)
at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genLoad(BCodeBodyBuilder.scala:397)
at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.$anonfun$genLoadArguments(BCodeBodyBuilder.scala:944)
at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genLoadArguments(BCodeBodyBuilder.scala:944)
at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genApply(BCodeBodyBuilder.scala:674)
at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genLoad(BCodeBodyBuilder.scala:304)
at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genLoad(BCodeBodyBuilder.scala:257)
at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genLoadQualifier(BCodeBodyBuilder.scala:909)
at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genTypeApply(BCodeBodyBuilder.scala:533)
at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genApply(BCodeBodyBuilder.scala:564)
at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genLoad(BCodeBodyBuilder.scala:304)
at scala.tools.nsc.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.emitNormalMethodBody(BCodeSkelBuilder.scala:609)
at scala.tools.nsc.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.genDefDef(BCodeSkelBuilder.scala:641)
at scala.tools.nsc.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.gen(BCodeSkelBuilder.scala:513)
at scala.tools.nsc.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.$anonfun$gen(BCodeSkelBuilder.scala:517)
at scala.tools.nsc.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.gen(BCodeSkelBuilder.scala:517)
at scala.tools.nsc.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.genPlainClass(BCodeSkelBuilder.scala:117)
at scala.tools.nsc.backend.jvm.CodeGen.genClass(CodeGen.scala:81)
at scala.tools.nsc.backend.jvm.CodeGen.genClassDef(CodeGen.scala:42)
at scala.tools.nsc.backend.jvm.CodeGen.$anonfun$genUnit(CodeGen.scala:66)
at scala.tools.nsc.backend.jvm.CodeGen.genClassDefs(CodeGen.scala:66)
at scala.tools.nsc.backend.jvm.CodeGen.$anonfun$genUnit(CodeGen.scala:65)
at scala.tools.nsc.backend.jvm.CodeGen.genClassDefs(CodeGen.scala:65)
at scala.tools.nsc.backend.jvm.CodeGen.$anonfun$genUnit(CodeGen.scala:70)
at scala.tools.nsc.backend.jvm.CodeGen.genUnit(CodeGen.scala:70)
at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase.apply(GenBCode.scala:74)
at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:454)
at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:402)
at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase.super$run(GenBCode.scala:80)
at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase.$anonfun$run(GenBCode.scala:80)
at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase.run(GenBCode.scala:78)
at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1511)
at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1495)
at scala.tools.nsc.Global$Run.compileSources(Global.scala:1488)
at scala.tools.nsc.Global$Run.compileFiles(Global.scala:1596)
at xsbt.CachedCompiler0.run(CompilerBridge.scala:163)
at xsbt.CachedCompiler0.run(CompilerBridge.scala:134)
at xsbt.CompilerBridge.run(CompilerBridge.scala:39)
at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:92)
at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile(MixedAnalyzingCompiler.scala:186)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
at sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:241)
at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile(MixedAnalyzingCompiler.scala:176)
at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$adapted(MixedAnalyzingCompiler.scala:157)
at sbt.internal.inc.JarUtils$.withPreviousJar(JarUtils.scala:239)
at sbt.internal.inc.MixedAnalyzingCompiler.compileScala(MixedAnalyzingCompiler.scala:157)
at sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:204)
at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal(IncrementalCompilerImpl.scala:573)
at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$adapted(IncrementalCompilerImpl.scala:573)
at sbt.internal.inc.Incremental$.$anonfun$apply(Incremental.scala:173)
at sbt.internal.inc.Incremental$.$anonfun$apply$adapted(Incremental.scala:171)
at sbt.internal.inc.Incremental$$anon.run(Incremental.scala:458)
at sbt.internal.inc.IncrementalCommon$CycleState.next(IncrementalCommon.scala:116)
at sbt.internal.inc.IncrementalCommon$$anon.next(IncrementalCommon.scala:56)
at sbt.internal.inc.IncrementalCommon$$anon.next(IncrementalCommon.scala:52)
at sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:261)
at sbt.internal.inc.Incremental$.$anonfun$incrementalCompile(Incremental.scala:413)
at sbt.internal.inc.Incremental$.withClassfileManager(Incremental.scala:498)
at sbt.internal.inc.Incremental$.incrementalCompile(Incremental.scala:400)
at sbt.internal.inc.Incremental$.apply(Incremental.scala:165)
at sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:573)
at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally(IncrementalCompilerImpl.scala:491)
at sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:332)
at sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:420)
at sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:137)
at sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:2176)
at sbt.Defaults$.$anonfun$compileIncrementalTask(Defaults.scala:2133)
at sbt.internal.io.Retry$.apply(Retry.scala:40)
at sbt.internal.io.Retry$.apply(Retry.scala:23)
at sbt.internal.server.BspCompileTask$.compute(BspCompileTask.scala:31)
at sbt.Defaults$.$anonfun$compileIncrementalTask(Defaults.scala:2129)
at scala.Function1.$anonfun$compose(Function1.scala:49)
at sbt.internal.util.$tilde$greater.$anonfun$$u2219(TypeFunctions.scala:62)
at sbt.std.Transform$$anon.work(Transform.scala:68)
at sbt.Execute.$anonfun$submit(Execute.scala:282)
at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23)
at sbt.Execute.work(Execute.scala:291)
at sbt.Execute.$anonfun$submit(Execute.scala:282)
at sbt.ConcurrentRestrictions$$anon.$anonfun$submitValid(ConcurrentRestrictions.scala:265)
at sbt.CompletionService$$anon.call(CompletionService.scala:64)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
错误来自同一包下的重复 class 名称。重命名后错误消失
// Main
package orga.toto
class Toto[A]
// Test
package orga.toto
class Toto // Error, rename it to fix it.
我在编译我的测试部分时遇到了这两个错误,不幸的是我试图找到解决这些问题的任何提示都失败了。
我尝试清理,从头开始重建,但没有成功。我在有和没有我的想法的情况下进行了编译,结果相同。
我正在使用 scala 2.12.12 和 sbt 1.5。
在我的研究过程中,我读了一些可能 link 到 java/scala 导入歧义的东西(https://github.com/scala/bug/issues/9111),但我没有 java 导入。
这是我的 scalac 选项:
scalacOptions ++= Seq(
"-unchecked",
"-deprecation",
"-feature",
"-language:higherKinds",
"-language:implicitConversions",
"-language:existentials",
"-Ypartial-unification",
),
当我遇到它们时的情况是当我询问特定 class 的通用类型时,我们称之为 Toto。例如,如果我这样写:
trait Test[
A, // Everything is OK
MyClass <: Toto[A] // Problem !
] {
def toto: Toto[Int] // Problem !
}
我试图重现我的问题,但是当我完全复制 classes 时,它们的层次结构。使用我复制的示例在测试中一切正常...
这里是完整的堆栈跟踪:
java.lang.AssertionError: assertion failed: Invalid interfaces in Lcom/XXX/TraitName;: List(Lcom/XXX;)
| => cat scala.tools.nsc.backend.jvm.BTypes$ClassBType.scala$tools$nsc$backend$jvm$BTypes$ClassBType$$checkInfoConsistency(BTypes.scala:644)
at scala.tools.nsc.backend.jvm.BTypes$ClassBType$.apply(BTypes.scala:826)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.classBTypeFromSymbol(BTypesFromSymbols.scala:105)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.$anonfun$computeClassInfo(BTypesFromSymbols.scala:331)
at scala.collection.immutable.List.map(List.scala:293)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.computeClassInfo(BTypesFromSymbols.scala:331)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.$anonfun$classBTypeFromSymbol(BTypesFromSymbols.scala:108)
at scala.tools.nsc.backend.jvm.BTypes$ClassBType$.apply(BTypes.scala:825)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.classBTypeFromSymbol(BTypesFromSymbols.scala:105)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.$anonfun$computeClassInfo(BTypesFromSymbols.scala:331)
at scala.collection.immutable.List.map(List.scala:293)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.computeClassInfo(BTypesFromSymbols.scala:331)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.$anonfun$classBTypeFromSymbol(BTypesFromSymbols.scala:108)
at scala.tools.nsc.backend.jvm.BTypes$ClassBType$.apply(BTypes.scala:825)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.classBTypeFromSymbol(BTypesFromSymbols.scala:105)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.$anonfun$computeClassInfo(BTypesFromSymbols.scala:331)
at scala.collection.immutable.List.map(List.scala:293)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.computeClassInfo(BTypesFromSymbols.scala:331)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.$anonfun$classBTypeFromSymbol(BTypesFromSymbols.scala:108)
at scala.tools.nsc.backend.jvm.BTypes$ClassBType$.apply(BTypes.scala:825)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.classBTypeFromSymbol(BTypesFromSymbols.scala:105)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.$anonfun$computeClassInfo(BTypesFromSymbols.scala:331)
at scala.collection.immutable.List.map(List.scala:293)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.computeClassInfo(BTypesFromSymbols.scala:331)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.$anonfun$classBTypeFromSymbol(BTypesFromSymbols.scala:108)
at scala.tools.nsc.backend.jvm.BTypes$ClassBType$.apply(BTypes.scala:825)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.classBTypeFromSymbol(BTypesFromSymbols.scala:105)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.$anonfun$typeToBType(BTypesFromSymbols.scala:163)
at scala.collection.immutable.HashMap$HashMap1.getOrElse0(HashMap.scala:355)
at scala.collection.immutable.HashMap$HashTrieMap.getOrElse0(HashMap.scala:587)
at scala.collection.immutable.HashMap.getOrElse(HashMap.scala:72)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.primitiveOrClassToBType(BTypesFromSymbols.scala:163)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.typeToBType(BTypesFromSymbols.scala:178)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.methodBTypeFromMethodType(BTypesFromSymbols.scala:127)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.methodBTypeFromSymbol(BTypesFromSymbols.scala:118)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.$anonfun$buildInlineInfoFromClassSymbol(BTypesFromSymbols.scala:585)
at scala.collection.Iterator$$anon.nextCur(Iterator.scala:486)
at scala.collection.Iterator$$anon.hasNext(Iterator.scala:492)
at scala.collection.Iterator.foreach(Iterator.scala:943)
at scala.collection.Iterator.foreach$(Iterator.scala:943)
at scala.collection.AbstractIterator.foreach(Iterator.scala:1431)
at scala.collection.generic.Growable.$plus$plus$eq(Growable.scala:62)
at scala.collection.generic.Growable.$plus$plus$eq$(Growable.scala:53)
at scala.collection.immutable.Map$MapBuilderImpl.$plus$plus$eq(Map.scala:583)
at scala.collection.immutable.Map$MapBuilderImpl.$plus$plus$eq(Map.scala:533)
at scala.collection.TraversableOnce.toMap(TraversableOnce.scala:354)
at scala.collection.TraversableOnce.toMap$(TraversableOnce.scala:352)
at scala.collection.AbstractIterator.toMap(Iterator.scala:1431)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.buildInlineInfoFromClassSymbol(BTypesFromSymbols.scala:618)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.buildInlineInfo(BTypesFromSymbols.scala:522)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.computeClassInfo(BTypesFromSymbols.scala:441)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.$anonfun$classBTypeFromSymbol(BTypesFromSymbols.scala:108)
at scala.tools.nsc.backend.jvm.BTypes$ClassBType$.apply(BTypes.scala:825)
at scala.tools.nsc.backend.jvm.BTypesFromSymbols.classBTypeFromSymbol(BTypesFromSymbols.scala:105)
at scala.tools.nsc.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.genPlainClass(BCodeSkelBuilder.scala:97)
at scala.tools.nsc.backend.jvm.CodeGen.genClass(CodeGen.scala:81)
at scala.tools.nsc.backend.jvm.CodeGen.genClassDef(CodeGen.scala:42)
at scala.tools.nsc.backend.jvm.CodeGen.$anonfun$genUnit(CodeGen.scala:66)
at scala.tools.nsc.backend.jvm.CodeGen.genClassDefs(CodeGen.scala:66)
at scala.tools.nsc.backend.jvm.CodeGen.$anonfun$genUnit(CodeGen.scala:65)
at scala.tools.nsc.backend.jvm.CodeGen.genClassDefs(CodeGen.scala:65)
at scala.tools.nsc.backend.jvm.CodeGen.$anonfun$genUnit(CodeGen.scala:70)
at scala.tools.nsc.backend.jvm.CodeGen.genUnit(CodeGen.scala:70)
at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase.apply(GenBCode.scala:74)
at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:454)
at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:402)
at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase.super$run(GenBCode.scala:80)
at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase.$anonfun$run(GenBCode.scala:80)
at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase.run(GenBCode.scala:78)
at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1511)
at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1495)
at scala.tools.nsc.Global$Run.compileSources(Global.scala:1488)
at scala.tools.nsc.Global$Run.compileFiles(Global.scala:1596)
at xsbt.CachedCompiler0.run(CompilerBridge.scala:163)
at xsbt.CachedCompiler0.run(CompilerBridge.scala:134)
at xsbt.CompilerBridge.run(CompilerBridge.scala:39)
at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:92)
at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile(MixedAnalyzingCompiler.scala:186)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
at sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:241)
at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile(MixedAnalyzingCompiler.scala:176)
at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$adapted(MixedAnalyzingCompiler.scala:157)
at sbt.internal.inc.JarUtils$.withPreviousJar(JarUtils.scala:239)
at sbt.internal.inc.MixedAnalyzingCompiler.compileScala(MixedAnalyzingCompiler.scala:157)
at sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:204)
at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal(IncrementalCompilerImpl.scala:573)
at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$adapted(IncrementalCompilerImpl.scala:573)
at sbt.internal.inc.Incremental$.$anonfun$apply(Incremental.scala:173)
at sbt.internal.inc.Incremental$.$anonfun$apply$adapted(Incremental.scala:171)
at sbt.internal.inc.Incremental$$anon.run(Incremental.scala:458)
at sbt.internal.inc.IncrementalCommon$CycleState.next(IncrementalCommon.scala:116)
at sbt.internal.inc.IncrementalCommon$$anon.next(IncrementalCommon.scala:56)
at sbt.internal.inc.IncrementalCommon$$anon.next(IncrementalCommon.scala:52)
at sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:261)
at sbt.internal.inc.Incremental$.$anonfun$incrementalCompile(Incremental.scala:413)
at sbt.internal.inc.Incremental$.withClassfileManager(Incremental.scala:498)
at sbt.internal.inc.Incremental$.incrementalCompile(Incremental.scala:400)
at sbt.internal.inc.Incremental$.apply(Incremental.scala:165)
at sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:573)
at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally(IncrementalCompilerImpl.scala:491)
at sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:332)
at sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:420)
at sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:137)
at sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:2176)
at sbt.Defaults$.$anonfun$compileIncrementalTask(Defaults.scala:2133)
at sbt.internal.io.Retry$.apply(Retry.scala:40)
at sbt.internal.io.Retry$.apply(Retry.scala:23)
at sbt.internal.server.BspCompileTask$.compute(BspCompileTask.scala:31)
at sbt.Defaults$.$anonfun$compileIncrementalTask(Defaults.scala:2129)
at scala.Function1.$anonfun$compose(Function1.scala:49)
at sbt.internal.util.$tilde$greater.$anonfun$$u2219(TypeFunctions.scala:62)
at sbt.std.Transform$$anon.work(Transform.scala:68)
at sbt.Execute.$anonfun$submit(Execute.scala:282)
at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23)
at sbt.Execute.work(Execute.scala:291)
at sbt.Execute.$anonfun$submit(Execute.scala:282)
at sbt.ConcurrentRestrictions$$anon.$anonfun$submitValid(ConcurrentRestrictions.scala:265)
at sbt.CompletionService$$anon.call(CompletionService.scala:64)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
java.lang.AssertionError: assertion failed: ClassBType.info not yet assigned: Lcom/xxx/Class;
| => cat scala.tools.nsc.backend.jvm.BTypes$ClassBType.info(BTypes.scala:620)
at scala.tools.nsc.backend.jvm.BTypes$ClassBType.isInterface(BTypes.scala:652)
at scala.tools.nsc.backend.jvm.BTypes$ClassBType.isSubtypeOf(BTypes.scala:707)
at scala.tools.nsc.backend.jvm.BTypes$ClassBType.$anonfun$isSubtypeOf(BTypes.scala:719)
at scala.tools.nsc.backend.jvm.BTypes$ClassBType.isSubtypeOf(BTypes.scala:719)
at scala.tools.nsc.backend.jvm.BTypes$ClassBType.$anonfun$isSubtypeOf(BTypes.scala:719)
at scala.tools.nsc.backend.jvm.BTypes$ClassBType.isSubtypeOf(BTypes.scala:719)
at scala.tools.nsc.backend.jvm.BTypes$ClassBType.$anonfun$isSubtypeOf(BTypes.scala:719)
at scala.tools.nsc.backend.jvm.BTypes$ClassBType.isSubtypeOf(BTypes.scala:719)
at scala.tools.nsc.backend.jvm.BTypes$ClassBType.$anonfun$isSubtypeOf(BTypes.scala:719)
at scala.tools.nsc.backend.jvm.BTypes$ClassBType.isSubtypeOf(BTypes.scala:719)
at scala.tools.nsc.backend.jvm.BTypes$ClassBType.$anonfun$isSubtypeOf(BTypes.scala:719)
at scala.tools.nsc.backend.jvm.BTypes$ClassBType.isSubtypeOf(BTypes.scala:719)
at scala.tools.nsc.backend.jvm.BTypes$BType.$anonfun$conformsTo(BTypes.scala:145)
at scala.tools.nsc.backend.jvm.BTypes$BType.conformsTo(BTypes.scala:118)
at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.adapt(BCodeBodyBuilder.scala:831)
at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genLoad(BCodeBodyBuilder.scala:397)
at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.$anonfun$genLoadArguments(BCodeBodyBuilder.scala:944)
at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genLoadArguments(BCodeBodyBuilder.scala:944)
at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genApply(BCodeBodyBuilder.scala:674)
at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genLoad(BCodeBodyBuilder.scala:304)
at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genLoad(BCodeBodyBuilder.scala:257)
at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genLoadQualifier(BCodeBodyBuilder.scala:909)
at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genTypeApply(BCodeBodyBuilder.scala:533)
at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genApply(BCodeBodyBuilder.scala:564)
at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genLoad(BCodeBodyBuilder.scala:304)
at scala.tools.nsc.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.emitNormalMethodBody(BCodeSkelBuilder.scala:609)
at scala.tools.nsc.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.genDefDef(BCodeSkelBuilder.scala:641)
at scala.tools.nsc.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.gen(BCodeSkelBuilder.scala:513)
at scala.tools.nsc.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.$anonfun$gen(BCodeSkelBuilder.scala:517)
at scala.tools.nsc.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.gen(BCodeSkelBuilder.scala:517)
at scala.tools.nsc.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.genPlainClass(BCodeSkelBuilder.scala:117)
at scala.tools.nsc.backend.jvm.CodeGen.genClass(CodeGen.scala:81)
at scala.tools.nsc.backend.jvm.CodeGen.genClassDef(CodeGen.scala:42)
at scala.tools.nsc.backend.jvm.CodeGen.$anonfun$genUnit(CodeGen.scala:66)
at scala.tools.nsc.backend.jvm.CodeGen.genClassDefs(CodeGen.scala:66)
at scala.tools.nsc.backend.jvm.CodeGen.$anonfun$genUnit(CodeGen.scala:65)
at scala.tools.nsc.backend.jvm.CodeGen.genClassDefs(CodeGen.scala:65)
at scala.tools.nsc.backend.jvm.CodeGen.$anonfun$genUnit(CodeGen.scala:70)
at scala.tools.nsc.backend.jvm.CodeGen.genUnit(CodeGen.scala:70)
at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase.apply(GenBCode.scala:74)
at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:454)
at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:402)
at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase.super$run(GenBCode.scala:80)
at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase.$anonfun$run(GenBCode.scala:80)
at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase.run(GenBCode.scala:78)
at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1511)
at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1495)
at scala.tools.nsc.Global$Run.compileSources(Global.scala:1488)
at scala.tools.nsc.Global$Run.compileFiles(Global.scala:1596)
at xsbt.CachedCompiler0.run(CompilerBridge.scala:163)
at xsbt.CachedCompiler0.run(CompilerBridge.scala:134)
at xsbt.CompilerBridge.run(CompilerBridge.scala:39)
at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:92)
at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile(MixedAnalyzingCompiler.scala:186)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
at sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:241)
at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile(MixedAnalyzingCompiler.scala:176)
at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$adapted(MixedAnalyzingCompiler.scala:157)
at sbt.internal.inc.JarUtils$.withPreviousJar(JarUtils.scala:239)
at sbt.internal.inc.MixedAnalyzingCompiler.compileScala(MixedAnalyzingCompiler.scala:157)
at sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:204)
at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal(IncrementalCompilerImpl.scala:573)
at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$adapted(IncrementalCompilerImpl.scala:573)
at sbt.internal.inc.Incremental$.$anonfun$apply(Incremental.scala:173)
at sbt.internal.inc.Incremental$.$anonfun$apply$adapted(Incremental.scala:171)
at sbt.internal.inc.Incremental$$anon.run(Incremental.scala:458)
at sbt.internal.inc.IncrementalCommon$CycleState.next(IncrementalCommon.scala:116)
at sbt.internal.inc.IncrementalCommon$$anon.next(IncrementalCommon.scala:56)
at sbt.internal.inc.IncrementalCommon$$anon.next(IncrementalCommon.scala:52)
at sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:261)
at sbt.internal.inc.Incremental$.$anonfun$incrementalCompile(Incremental.scala:413)
at sbt.internal.inc.Incremental$.withClassfileManager(Incremental.scala:498)
at sbt.internal.inc.Incremental$.incrementalCompile(Incremental.scala:400)
at sbt.internal.inc.Incremental$.apply(Incremental.scala:165)
at sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:573)
at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally(IncrementalCompilerImpl.scala:491)
at sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:332)
at sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:420)
at sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:137)
at sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:2176)
at sbt.Defaults$.$anonfun$compileIncrementalTask(Defaults.scala:2133)
at sbt.internal.io.Retry$.apply(Retry.scala:40)
at sbt.internal.io.Retry$.apply(Retry.scala:23)
at sbt.internal.server.BspCompileTask$.compute(BspCompileTask.scala:31)
at sbt.Defaults$.$anonfun$compileIncrementalTask(Defaults.scala:2129)
at scala.Function1.$anonfun$compose(Function1.scala:49)
at sbt.internal.util.$tilde$greater.$anonfun$$u2219(TypeFunctions.scala:62)
at sbt.std.Transform$$anon.work(Transform.scala:68)
at sbt.Execute.$anonfun$submit(Execute.scala:282)
at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23)
at sbt.Execute.work(Execute.scala:291)
at sbt.Execute.$anonfun$submit(Execute.scala:282)
at sbt.ConcurrentRestrictions$$anon.$anonfun$submitValid(ConcurrentRestrictions.scala:265)
at sbt.CompletionService$$anon.call(CompletionService.scala:64)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
错误来自同一包下的重复 class 名称。重命名后错误消失
// Main
package orga.toto
class Toto[A]
// Test
package orga.toto
class Toto // Error, rename it to fix it.