Set up the project with: git clone --recursive https://github.com/chipsalliance/rocket-chip. sbt compiles fine, but with "bloop compile rocketchip", got this error:
Compiling rocketchip (313 Scala sources)
Compiled rocketchip (3590ms)
java.lang.AssertionError: assertion failed:
Context(Decode.scala) {
owner = method apply
tree = DefDef:def <apply: error>(<addr: error>: UInt, default: Seq[BitPat], <mapping
scope = 3 decls
contextMode = AmbiguousErrors MacrosEnabled TypeConstructorAllowed
outer.owner = method apply
}
@tuarba This most likely has to do with an error in the macro implementation, not bloop. I've reproduced it locally and the stack traces point to compiler stack traces. The environment between sbt and bloop is a little bit different but fundamentally the same. As it compiles in sbt and not in bloop, it means the macro implementation must be assuming something that is generally not correct.
What is the implementation of Decode.scala doing?
Full stack trace is the following:
Compiling rocketchip (313 Scala sources)
Compiled rocketchip (5201ms)
java.lang.AssertionError: assertion failed:
Context(Decode.scala) {
owner = method apply
tree = DefDef:def <apply: error>(<addr: error>: UInt, default: Seq[BitPat], <mapping
scope = 3 decls
contextMode = AmbiguousErrors MacrosEnabled TypeConstructorAllowed
outer.owner = method apply
}
while compiling: /Users/jvicentecantero/Code/rocket-chip/src/main/scala/rocket/Decode.scala
during phase: typer
library version: version 2.12.10
compiler version: version 2.12.10
reconstructed args: -bootclasspath /Library/Java/JavaVirtualMachines/graalvm-ce-19.2.1/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/graalvm-ce-19.2.1/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/graalvm-ce-19.2.1/Contents/Home/jre/lib/sunrsasign.jar:/Library/Java/JavaVirtualMachines/graalvm-ce-19.2.1/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/graalvm-ce-19.2.1/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/graalvm-ce-19.2.1/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/graalvm-ce-19.2.1/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/graalvm-ce-19.2.1/Contents/Home/jre/lib/jvmci-services.jar:/Library/Java/JavaVirtualMachines/graalvm-ce-19.2.1/Contents/Home/jre/classes:/Library/Java/JavaVirtualMachines/graalvm-ce-19.2.1/Contents/Home/jre/lib/boot/graaljs-scriptengine.jar:/Library/Java/JavaVirtualMachines/graalvm-ce-19.2.1/Contents/Home/jre/lib/boot/graal-sdk.src.zip:/Library/Java/JavaVirtualMachines/graalvm-ce-19.2.1/Contents/Home/jre/lib/boot/graal-sdk.jar:/Users/jvicentecantero/.sbt/boot/scala-2.12.10/lib/scala-library.jar -deprecation -unchecked -classpath /Users/jvicentecantero/Code/rocket-chip/src/main/resources:/Users/jvicentecantero/Code/rocket-chip/.bloop/rocketchip/bloop-internal-classes/bloop-cli--dKagF1FRWaZ-Qg_wGLDmQ==:/Users/jvicentecantero/Code/rocket-chip/.bloop/rocketchip/scala-2.12/classes-empty-rocketchip:/Users/jvicentecantero/Code/rocket-chip/chisel3/src/main/resources:/Users/jvicentecantero/Code/rocket-chip/.bloop/chisel/bloop-internal-classes/bloop-cli-lrjjUmMPS8uP5K0bHzGdSQ==:/Users/jvicentecantero/Code/rocket-chip/.bloop/chisel/scala-2.12/classes-empty-chisel:/Users/jvicentecantero/Code/rocket-chip/.bloop/api-config-chipsalliance/scala-2.12/classes:/Users/jvicentecantero/Code/rocket-chip/.bloop/hardfloat/scala-2.12/classes:/Users/jvicentecantero/Code/rocket-chip/.bloop/rocket-macros/scala-2.12/classes:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/joda/joda-convert/2.2.0/joda-convert-2.2.0.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/joda-time/joda-time/2.10.1/joda-time-2.10.1.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/json4s/json4s-jackson_2.12/3.6.1/json4s-jackson_2.12-3.6.1.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/net/jcazevedo/moultingyaml_2.12/0.4.1/moultingyaml_2.12-0.4.1.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/apache/commons/commons-lang3/3.9/commons-lang3-3.9.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/com/github/scopt/scopt_2.12/3.7.1/scopt_2.12-3.7.1.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/json4s/json4s-ast_2.12/3.6.7/json4s-ast_2.12-3.6.7.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-annotations/2.9.0/jackson-annotations-2.9.0.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/json4s/json4s-core_2.12/3.6.7/json4s-core_2.12-3.6.7.jar:/Users/jvicentecantero/.sbt/boot/scala-2.12.10/lib/scala-reflect.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/json4s/json4s-scalap_2.12/3.6.7/json4s-scalap_2.12-3.6.7.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/apache/commons/commons-text/1.7/commons-text-1.7.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/edu/berkeley/cs/firrtl_2.12/1.2.1/firrtl_2.12-1.2.1.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/com/google/protobuf/protobuf-java/3.4.0/protobuf-java-3.4.0.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/com/github/nscala-time/nscala-time_2.12/2.22.0/nscala-time_2.12-2.22.0.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/antlr/antlr4-runtime/4.7.1/antlr4-runtime-4.7.1.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/com/thoughtworks/paranamer/paranamer/2.8/paranamer-2.8.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-core/2.9.6/jackson-core-2.9.6.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/com/typesafe/scala-logging/scala-logging_2.12/3.9.0/scala-logging_2.12-3.9.0.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/json4s/json4s-native_2.12/3.6.7/json4s-native_2.12-3.6.7.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-databind/2.9.6/jackson-databind-2.9.6.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/ch/qos/logback/logback-core/1.2.3/logback-core-1.2.3.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/yaml/snakeyaml/1.24/snakeyaml-1.24.jar -Xplugin:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scalamacros/paradise_2.12.10/2.1.0/paradise_2.12.10-2.1.0.jar -Xsource:2.11.0
last tree to typer: Ident(scala)
tree position: line 53 of /Users/jvicentecantero/Code/rocket-chip/src/main/scala/rocket/Decode.scala
tree tpe: scala.type
symbol: final package scala
symbol definition: final package scala (a ModuleSymbol)
symbol package: <none>
symbol owners: package scala
call site: method apply in object DecodeLogic in package rocket
== Source file context for tree position ==
50 yield apply(addr, thisDefault, thisMapping)
51 }
52 def apply(addr: UInt, default: Seq[BitPat], mappingIn: List[(UInt, Seq[BitPat])]): Seq[UInt] =
53 apply(addr, default, mappingIn.map(m => (BitPat(m._1), m._2)).asInstanceOf[Iterable[(BitPat, Seq[BitPat])]])
54 def apply(addr: UInt, trues: Iterable[UInt], falses: Iterable[UInt]): Bool =
55 apply(addr, BitPat.dontCare(1), trues.map(BitPat(_) -> BitPat("b1")) ++ falses.map(BitPat(_) -> BitPat("b0"))).asBool
56 private val caches = Map[UInt,Map[Term,Bool]]()
at scala.reflect.internal.SymbolTable.throwAssertionError(SymbolTable.scala:184)
at scala.tools.nsc.typechecker.Typers$Typer.vanillaAdapt$1(Typers.scala:1170)
at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:1224)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5730)
at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typed1$62(Typers.scala:5122)
at scala.tools.nsc.typechecker.Typers$Typer.typedTypeSelectionQualifier$1(Typers.scala:5122)
at scala.tools.nsc.typechecker.Typers$Typer.typedSelectOrSuperCall$1(Typers.scala:5130)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5671)
at scala.tools.nsc.typechecker.Typers$Typer.typedAppliedTypeTree$1(Typers.scala:5260)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5623)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5716)
at scala.tools.nsc.typechecker.Typers$Typer.typedType(Typers.scala:5842)
at scala.tools.nsc.typechecker.Typers$Typer.typedHigherKindedType(Typers.scala:5849)
at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typed1$75(Typers.scala:5284)
at scala.tools.nsc.typechecker.Typers$Typer.typedAppliedTypeTree$1(Typers.scala:5273)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5623)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5716)
at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typedHigherKindedType$2(Typers.scala:5778)
at scala.tools.nsc.typechecker.Typers$Typer.typedHigherKindedType(Typers.scala:5853)
at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typed1$86(Typers.scala:5480)
at scala.tools.nsc.typechecker.Typers$Typer.typedTypeApply$1(Typers.scala:5480)
at scala.tools.nsc.typechecker.Typers$Typer.typedOutsidePatternMode$1(Typers.scala:5647)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5680)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5716)
at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typedArg$1(Typers.scala:3371)
at scala.tools.nsc.typechecker.Typers$Typer.typedArg(Typers.scala:490)
at scala.tools.nsc.typechecker.Typers$Typer.typedArg0$1(Typers.scala:3509)
at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$doTypedApply$14(Typers.scala:3528)
at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$doTypedApply$13(Typers.scala:3499)
at scala.tools.nsc.typechecker.Contexts$Context.$anonfun$savingUndeterminedTypeParams$1(Contexts.scala:342)
at scala.tools.nsc.typechecker.Contexts$Context.savingUndeterminedTypeParams(Contexts.scala:406)
at scala.tools.nsc.typechecker.Typers$Typer.handleOverloaded$1(Typers.scala:3497)
at scala.tools.nsc.typechecker.Typers$Typer.doTypedApply(Typers.scala:3541)
at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typed1$26(Typers.scala:4772)
at scala.tools.nsc.typechecker.Typers$Typer.silent(Typers.scala:714)
at scala.tools.nsc.typechecker.Typers$Typer.tryTypedApply$1(Typers.scala:4772)
at scala.tools.nsc.typechecker.Typers$Typer.normalTypedApply$1(Typers.scala:4856)
at scala.tools.nsc.typechecker.Typers$Typer.typedApply$1(Typers.scala:4867)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5670)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5716)
at scala.tools.nsc.typechecker.Typers$Typer.typedDefDef(Typers.scala:5932)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5635)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5716)
at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:5780)
at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typedStats$10(Typers.scala:3353)
at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:3353)
at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:2013)
at scala.tools.nsc.typechecker.Typers$Typer.typedModuleDef(Typers.scala:1879)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5637)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5716)
at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:5780)
at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typedStats$10(Typers.scala:3353)
at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:3353)
at scala.tools.nsc.typechecker.Typers$Typer.typedPackageDef$1(Typers.scala:5346)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5639)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5716)
at scala.tools.nsc.typechecker.Analyzer$typerFactory$TyperPhase.apply(Analyzer.scala:114)
at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:453)
at scala.tools.nsc.typechecker.Analyzer$typerFactory$TyperPhase.run(Analyzer.scala:103)
at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1503)
at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1487)
at scala.tools.nsc.Global$Run.compileSources(Global.scala:1480)
at scala.tools.nsc.Global$Run.compile(Global.scala:1606)
at xsbt.CachedCompiler0.run(CompilerInterface.scala:148)
at xsbt.CachedCompiler0.run(CompilerInterface.scala:123)
at xsbt.CompilerInterface.run(CompilerInterface.scala:35)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sbt.internal.inc.AnalyzingCompiler.call(AnalyzingCompiler.scala:252)
at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:121)
at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:94)
at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.compileSources$1(BloopHighLevelCompiler.scala:142)
at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.$anonfun$compile$7(BloopHighLevelCompiler.scala:160)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.$anonfun$compile$1(BloopHighLevelCompiler.scala:72)
at bloop.tracing.BraveTracer.trace(BraveTracer.scala:31)
at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.timed$1(BloopHighLevelCompiler.scala:71)
at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.$anonfun$compile$6(BloopHighLevelCompiler.scala:160)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
at monix.eval.internal.TaskRunLoop$.monix$eval$internal$TaskRunLoop$$loop$1(TaskRunLoop.scala:187)
at monix.eval.internal.TaskRunLoop$RestartCallback$1.onSuccess(TaskRunLoop.scala:119)
at monix.eval.Task$.$anonfun$forkedUnit$2(Task.scala:1463)
at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1402)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
[E] Unexpected error when compiling rocketchip: 'assertion failed:
[E] Context(Decode.scala) {
[E] owner = method apply
[E] tree = DefDef:def <apply: error>(<addr: error>: UInt, default: Seq[BitPat], <mapping
[E] scope = 3 decls
[E] contextMode = AmbiguousErrors MacrosEnabled TypeConstructorAllowed
[E] outer.owner = method apply
[E] }
[E] while compiling: /Users/jvicentecantero/Code/rocket-chip/src/main/scala/rocket/Decode.scala
[E] during phase: typer
[E] library version: version 2.12.10
[E] compiler version: version 2.12.10
[E] reconstructed args: -bootclasspath /Library/Java/JavaVirtualMachines/graalvm-ce-19.2.1/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/graalvm-ce-19.2.1/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/graalvm-ce-19.2.1/Contents/Home/jre/lib/sunrsasign.jar:/Library/Java/JavaVirtualMachines/graalvm-ce-19.2.1/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/graalvm-ce-19.2.1/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/graalvm-ce-19.2.1/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/graalvm-ce-19.2.1/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/graalvm-ce-19.2.1/Contents/Home/jre/lib/jvmci-services.jar:/Library/Java/JavaVirtualMachines/graalvm-ce-19.2.1/Contents/Home/jre/classes:/Library/Java/JavaVirtualMachines/graalvm-ce-19.2.1/Contents/Home/jre/lib/boot/graaljs-scriptengine.jar:/Library/Java/JavaVirtualMachines/graalvm-ce-19.2.1/Contents/Home/jre/lib/boot/graal-sdk.src.zip:/Library/Java/JavaVirtualMachines/graalvm-ce-19.2.1/Contents/Home/jre/lib/boot/graal-sdk.jar:/Users/jvicentecantero/.sbt/boot/scala-2.12.10/lib/scala-library.jar -deprecation -unchecked -classpath /Users/jvicentecantero/Code/rocket-chip/src/main/resources:/Users/jvicentecantero/Code/rocket-chip/.bloop/rocketchip/bloop-internal-classes/bloop-cli--dKagF1FRWaZ-Qg_wGLDmQ==:/Users/jvicentecantero/Code/rocket-chip/.bloop/rocketchip/scala-2.12/classes-empty-rocketchip:/Users/jvicentecantero/Code/rocket-chip/chisel3/src/main/resources:/Users/jvicentecantero/Code/rocket-chip/.bloop/chisel/bloop-internal-classes/bloop-cli-lrjjUmMPS8uP5K0bHzGdSQ==:/Users/jvicentecantero/Code/rocket-chip/.bloop/chisel/scala-2.12/classes-empty-chisel:/Users/jvicentecantero/Code/rocket-chip/.bloop/api-config-chipsalliance/scala-2.12/classes:/Users/jvicentecantero/Code/rocket-chip/.bloop/hardfloat/scala-2.12/classes:/Users/jvicentecantero/Code/rocket-chip/.bloop/rocket-macros/scala-2.12/classes:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/joda/joda-convert/2.2.0/joda-convert-2.2.0.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/joda-time/joda-time/2.10.1/joda-time-2.10.1.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/json4s/json4s-jackson_2.12/3.6.1/json4s-jackson_2.12-3.6.1.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/net/jcazevedo/moultingyaml_2.12/0.4.1/moultingyaml_2.12-0.4.1.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/apache/commons/commons-lang3/3.9/commons-lang3-3.9.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/com/github/scopt/scopt_2.12/3.7.1/scopt_2.12-3.7.1.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/json4s/json4s-ast_2.12/3.6.7/json4s-ast_2.12-3.6.7.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-annotations/2.9.0/jackson-annotations-2.9.0.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/json4s/json4s-core_2.12/3.6.7/json4s-core_2.12-3.6.7.jar:/Users/jvicentecantero/.sbt/boot/scala-2.12.10/lib/scala-reflect.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/json4s/json4s-scalap_2.12/3.6.7/json4s-scalap_2.12-3.6.7.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/apache/commons/commons-text/1.7/commons-text-1.7.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/edu/berkeley/cs/firrtl_2.12/1.2.1/firrtl_2.12-1.2.1.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/com/google/protobuf/protobuf-java/3.4.0/protobuf-java-3.4.0.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/com/github/nscala-time/nscala-time_2.12/2.22.0/nscala-time_2.12-2.22.0.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/antlr/antlr4-runtime/4.7.1/antlr4-runtime-4.7.1.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/com/thoughtworks/paranamer/paranamer/2.8/paranamer-2.8.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-core/2.9.6/jackson-core-2.9.6.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/com/typesafe/scala-logging/scala-logging_2.12/3.9.0/scala-logging_2.12-3.9.0.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/json4s/json4s-native_2.12/3.6.7/json4s-native_2.12-3.6.7.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-databind/2.9.6/jackson-databind-2.9.6.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/ch/qos/logback/logback-core/1.2.3/logback-core-1.2.3.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/yaml/snakeyaml/1.24/snakeyaml-1.24.jar -Xplugin:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scalamacros/paradise_2.12.10/2.1.0/paradise_2.12.10-2.1.0.jar -Xsource:2.11.0
[E]
[E] last tree to typer: Ident(scala)
[E] tree position: line 53 of /Users/jvicentecantero/Code/rocket-chip/src/main/scala/rocket/Decode.scala
[E] tree tpe: scala.type
[E] symbol: final package scala
[E] symbol definition: final package scala (a ModuleSymbol)
[E] symbol package: <none>
[E] symbol owners: package scala
[E] call site: method apply in object DecodeLogic in package rocket
[E]
[E] == Source file context for tree position ==
[E]
[E] 50 yield apply(addr, thisDefault, thisMapping)
[E] 51 }
[E] 52 def apply(addr: UInt, default: Seq[BitPat], mappingIn: List[(UInt, Seq[BitPat])]): Seq[UInt] =
[E] 53 apply(addr, default, mappingIn.map(m => (BitPat(m._1), m._2)).asInstanceOf[Iterable[(BitPat, Seq[BitPat])]])
[E] 54 def apply(addr: UInt, trues: Iterable[UInt], falses: Iterable[UInt]): Bool =
[E] 55 apply(addr, BitPat.dontCare(1), trues.map(BitPat(_) -> BitPat("b1")) ++ falses.map(BitPat(_) -> BitPat("b0"))).asBool
[E] 56 private val caches = Map[UInt,Map[Term,Bool]]()'
[E] Failed to compile 'rocketchip'
➜ rocket-chip git:(master) ✗ bloop compile rocketchip
Compiling rocketchip (313 Scala sources)
Compiled rocketchip (3264ms)
[E] Unexpected error when compiling rocketchip: 'assertion failed:
[E] Context(Decode.scala) {
[E] owner = method apply
[E] tree = DefDef:def <apply: error>(<addr: error>: UInt, default: Seq[BitPat], <mapping
[E] scope = 3 decls
[E] contextMode = AmbiguousErrors MacrosEnabled TypeConstructorAllowed
[E] outer.owner = method apply
[E] }
[E] while compiling: /Users/jvicentecantero/Code/rocket-chip/src/main/scala/rocket/Decode.scala
[E] during phase: typer
[E] library version: version 2.12.10
[E] compiler version: version 2.12.10
[E] reconstructed args: -bootclasspath /Library/Java/JavaVirtualMachines/graalvm-ce-19.2.1/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/graalvm-ce-19.2.1/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/graalvm-ce-19.2.1/Contents/Home/jre/lib/sunrsasign.jar:/Library/Java/JavaVirtualMachines/graalvm-ce-19.2.1/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/graalvm-ce-19.2.1/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/graalvm-ce-19.2.1/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/graalvm-ce-19.2.1/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/graalvm-ce-19.2.1/Contents/Home/jre/lib/jvmci-services.jar:/Library/Java/JavaVirtualMachines/graalvm-ce-19.2.1/Contents/Home/jre/classes:/Library/Java/JavaVirtualMachines/graalvm-ce-19.2.1/Contents/Home/jre/lib/boot/graaljs-scriptengine.jar:/Library/Java/JavaVirtualMachines/graalvm-ce-19.2.1/Contents/Home/jre/lib/boot/graal-sdk.src.zip:/Library/Java/JavaVirtualMachines/graalvm-ce-19.2.1/Contents/Home/jre/lib/boot/graal-sdk.jar:/Users/jvicentecantero/.sbt/boot/scala-2.12.10/lib/scala-library.jar -deprecation -unchecked -classpath /Users/jvicentecantero/Code/rocket-chip/src/main/resources:/Users/jvicentecantero/Code/rocket-chip/.bloop/rocketchip/bloop-internal-classes/bloop-cli-Qnfx3aMfQ_qig5NQl046Nw==:/Users/jvicentecantero/Code/rocket-chip/.bloop/rocketchip/scala-2.12/classes-empty-rocketchip:/Users/jvicentecantero/Code/rocket-chip/chisel3/src/main/resources:/Users/jvicentecantero/Code/rocket-chip/.bloop/chisel/bloop-internal-classes/bloop-cli-lrjjUmMPS8uP5K0bHzGdSQ==:/Users/jvicentecantero/Code/rocket-chip/.bloop/api-config-chipsalliance/scala-2.12/classes:/Users/jvicentecantero/Code/rocket-chip/.bloop/hardfloat/scala-2.12/classes:/Users/jvicentecantero/Code/rocket-chip/.bloop/rocket-macros/scala-2.12/classes:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/joda/joda-convert/2.2.0/joda-convert-2.2.0.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/joda-time/joda-time/2.10.1/joda-time-2.10.1.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/json4s/json4s-jackson_2.12/3.6.1/json4s-jackson_2.12-3.6.1.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/net/jcazevedo/moultingyaml_2.12/0.4.1/moultingyaml_2.12-0.4.1.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/apache/commons/commons-lang3/3.9/commons-lang3-3.9.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/com/github/scopt/scopt_2.12/3.7.1/scopt_2.12-3.7.1.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/json4s/json4s-ast_2.12/3.6.7/json4s-ast_2.12-3.6.7.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-annotations/2.9.0/jackson-annotations-2.9.0.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/json4s/json4s-core_2.12/3.6.7/json4s-core_2.12-3.6.7.jar:/Users/jvicentecantero/.sbt/boot/scala-2.12.10/lib/scala-reflect.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/json4s/json4s-scalap_2.12/3.6.7/json4s-scalap_2.12-3.6.7.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/apache/commons/commons-text/1.7/commons-text-1.7.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/edu/berkeley/cs/firrtl_2.12/1.2.1/firrtl_2.12-1.2.1.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/com/google/protobuf/protobuf-java/3.4.0/protobuf-java-3.4.0.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/com/github/nscala-time/nscala-time_2.12/2.22.0/nscala-time_2.12-2.22.0.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/antlr/antlr4-runtime/4.7.1/antlr4-runtime-4.7.1.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/com/thoughtworks/paranamer/paranamer/2.8/paranamer-2.8.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-core/2.9.6/jackson-core-2.9.6.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/com/typesafe/scala-logging/scala-logging_2.12/3.9.0/scala-logging_2.12-3.9.0.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/json4s/json4s-native_2.12/3.6.7/json4s-native_2.12-3.6.7.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-databind/2.9.6/jackson-databind-2.9.6.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/ch/qos/logback/logback-core/1.2.3/logback-core-1.2.3.jar:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/yaml/snakeyaml/1.24/snakeyaml-1.24.jar -Xplugin:/Users/jvicentecantero/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scalamacros/paradise_2.12.10/2.1.0/paradise_2.12.10-2.1.0.jar -Xsource:2.11.0
[E]
[E] last tree to typer: Ident(scala)
[E] tree position: line 53 of /Users/jvicentecantero/Code/rocket-chip/src/main/scala/rocket/Decode.scala
[E] tree tpe: scala.type
[E] symbol: final package scala
[E] symbol definition: final package scala (a ModuleSymbol)
[E] symbol package: <none>
[E] symbol owners: package scala
[E] call site: method apply in object DecodeLogic in package rocket
[E]
[E] == Source file context for tree position ==
[E]
[E] 50 yield apply(addr, thisDefault, thisMapping)
[E] 51 }
[E] 52 def apply(addr: UInt, default: Seq[BitPat], mappingIn: List[(UInt, Seq[BitPat])]): Seq[UInt] =
[E] 53 apply(addr, default, mappingIn.map(m => (BitPat(m._1), m._2)).asInstanceOf[Iterable[(BitPat, Seq[BitPat])]])
[E] 54 def apply(addr: UInt, trues: Iterable[UInt], falses: Iterable[UInt]): Bool =
[E] 55 apply(addr, BitPat.dontCare(1), trues.map(BitPat(_) -> BitPat("b1")) ++ falses.map(BitPat(_) -> BitPat("b0"))).asBool
[E] 56 private val caches = Map[UInt,Map[Term,Bool]]()'
[E] Failed to compile 'rocketchip'
As I am just a user of rocket-chip, I'm not sure about what Decode.scala is really doing. However I found a work around by adding "rocket-chip/chisel3/target/scala-2.12/chisel3_2.12-3.2.1.jar" to the 'classpath' section of .bloop/rocketchip.json. Then bloop will compile. The other sub projects don't seem to matter. Only adding chisel3 works.
That's very interesting. I'll have a closer look at this, I'm curious to see what's happening. Thanks for reporting @tuarba
Hi @tuarba, after digging into this, I've realized this error happens because chisel is using compile-internal which is an exotic sbt configuration that we don't support. Thanks for reporting. Looping in @jackkoenig who might be able to change that upstream
I have the same problem as the OP. I got here by trying to use VS Code to modify Rocket using the Scala (Metals) plugin, which chokes because of this assertion failure.
I tried the workaround suggested by @tuarba . It did not work. Now, instead of an assertion failure, "bloop compile rocketchip" spews around 7500 lines of (to me) inscrutable error messages. FWIW, the first of those message is:
~/bld/rocket-chip[master]$ ~/.bloop/bloop compile rocketchip
Compiling rocketchip (313 Scala sources)
[E] [E1755] src/main/scala/util/PSDTestMode.scala:11:43
[E] no arguments allowed for nullary constructor Object: ()Object
[E] L11: BundleBridgeEphemeralNode[PSDTestMode]()(ValName("global_psd_test_mode"))
[E] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I tried putting chisel3_2.12-3.2.1.jar in a few different places on the classpath, including first, with the same results.
@jvican , you say the problem is the use of compile-internal. I assume you mean in build.sbt. Is there an alternative you can recommend? Or should I be using some other tool besides bloop that can provide language services for this project?
Bloop doesn’t support any configuration that ends with -internal. As a workaround, I recommend replacing compile-internal with compile and so on for every internal configuration. The semantics of the build will change slightly, you can read more about it in the sbt docs, but it should work to hack on chisel.
I tried replacing "compile" with "compile-internal" (all 3 instances) in build.sbt, but that made no difference; bloop still fails the assertion in the same way.
Try nuking the contents of .bloop and reexporting the project with Metals again. If the issue is the same I'll have a closer look.
That may have worked; now, instead of an assertion failure, "bloop compile rocketchip" produces a large number of compile error messages. The first is:
$ ~/.bloop/bloop compile rocketchip
Compiling hardfloat (27 Scala sources)
[E] [E316] hardfloat/src/main/scala/tests.scala:209:32
[E] overloaded method value execute with alternatives:
[E] (args: Array[String],dut: () => chisel3.RawModule)chisel3.ChiselExecutionResult <and>
[E] (optionsManager: firrtl.ExecutionOptionsManager with chisel3.HasChiselExecutionOptions with firrtl.HasFirrtlOptions,dut: () => chisel3.RawModule)chisel3.ChiselExecutionResult
[E] cannot be applied to (Array[String], () => hardfloat.ValExec_CompareRecF64_eq)
[E] L209: chisel3.Driver.execute(
[E] ^^^^^^^^^^^^^^^^^^^^^^
Given that sbt can still compile the project after replacing "compile-internal" with "compile", but bloop cannot, is that a separate bloop incompatibility?
Sorry @jvican, been on vacation but am now back. Per the "compile-internal" stuff, I am not sure but will dig.
I'm going to guess that the issue @smcpeak is seeing is due to hardfloat's dependency on chisel3 not working properly. The most likely reason I can think of for this is that some of the source dependencies in rocket-chip are conditional on environment variables (to allow switching between source vs. published dependencies). See the definition of the hardfloat project in rocket-chip: https://github.com/chipsalliance/rocket-chip/blob/36d87efff806af629753568dfe6755caa3c8c2c6/build.sbt#L72. This function makes the dependency conditional on an environment variable, and perhaps the SBT-to-Bloop export can't support this
@jackkoenig Let me know if you've unraveled the why of those dependencies in rocket-chip. It'd be useful to know how critical fixing this would be for people using compile internal and test internal dependencies.
I think it was copied from Chisel3 where someone used it to publish all of the sub-projects as a single project on maven. We discussed this at a dev meeting recently and decided that there's no real reason to do that so we can probably get rid of it. This is assuming we can still build the Scaladocs together even if the artifacts publish separately which I believe we already use Unidoc (https://github.com/sbt/sbt-unidoc) for so should be fine.
Thanks for the feedback! The less projects using CompileInternal and TestInternal, the better.
As W/A compiler-internal usually replaced by provided that is initially designed for frameworks and environment which provide own implementation of the dependency in run-time.
The main difference that dependencies with ...-internal scopes don't appear in the published .pom files and users shouldn't guess if it really required in run-time or not.
I've have listed a couple of use cases for those scopes in this issue.
Yup, I’m aware of these issues. Nevertheless that behavior can be simulated by post processing the Pom files with sbt. If people really need this then I encourage them to find other ways of excluding dependencies as I don’t have the time to add support for these configurations right now.
https://www.scala-sbt.org/1.x/docs/Macro-Projects.html suggests using "compile-internal". i'd still call it "exotic", but...
Looks like that's where we originally got this for chisel3. It is a bit annoying that SBT conflates the notion of compilation units with publishable units. I don't see any reason why it should require compile-internal to accomplish such a goal.
I have removed compile-internal from chisel3, it won't be visible in rocket-chip until we bump (hopefully early next week to the soon to be released 3.3.0). There is also some compile-internal in rocket-chip that I intend to remove when bumping.
Great, thanks @jackkoenig Let's close this ticket.
scala-sbt.org/1.x/docs/Macro-Projects.html suggests using "compile-internal". i'd still call it "exotic", but...
Yeah, this is a judgment call, it's exotic but publically documented, I think they both can be true at the same time.
Most helpful comment
I think it was copied from Chisel3 where someone used it to publish all of the sub-projects as a single project on maven. We discussed this at a dev meeting recently and decided that there's no real reason to do that so we can probably get rid of it. This is assuming we can still build the Scaladocs together even if the artifacts publish separately which I believe we already use Unidoc (https://github.com/sbt/sbt-unidoc) for so should be fine.