Rename all object interface traits, $ => Obj#5274
Conversation
This works around a bug in IntelliJ which assumes that $ signifies an inner class and thus it does not properly find public APIs defined in these traits.
| ProblemFilter.exclude[IncompatibleResultTypeProblem]("chisel3.util.BitPat.fromUIntToBitPatComparable"), | ||
| ProblemFilter.exclude[IncompatibleResultTypeProblem]("chisel3.util.BitPat.fromUIntToBitPatComparable") |
There was a problem hiding this comment.
These two are not acceptable to waive, it was a bit annoying to show this but what I did was:
//> using repository https://central.sonatype.com/repository/maven-snapshots
//> using scala 2.13.18
//> using dep org.chipsalliance::chisel:7.10.0
//> using plugin org.chipsalliance:::chisel-plugin:7.10.0
//> using options -unchecked -deprecation -language:reflectiveCalls -feature -Xcheckinit
//> using options -Xfatal-warnings -Ywarn-dead-code -Ywarn-unused -Ymacro-annotations
import chisel3._
import chisel3.util._
// _root_ disambiguates from package chisel3.util.circt if user imports chisel3.util._
import _root_.circt.stage.ChiselStage
class Foo extends Module {
val out = IO(Output(Bool()))
out := 0x0f.U === BitPat("b??0011??")
}
object Main extends App {
println(
ChiselStage.emitSystemVerilog(
gen = new Foo,
firtoolOpts = Array("-disable-all-randomization", "-strip-debug-info", "-default-layer-specialization=enable")
)
)
}Then I get the classpath of this from scala-cli
scala-cli compile . --print-class-path
Then I took that classpath and replaced the chisel jar with a locally published one with this change, then I manually ran that with java which resulted in a runtime error.
abdd5d5 to
efd55bb
Compare
seldridge
left a comment
There was a problem hiding this comment.
Nice. This is a clever way of solving this.
<rant>
We should not be making code changes based on bugs in editors. Jetbrains has repeatedly shown that they either are incapable of properly supporting Scala, they don't care about supporting Scala, or they are just grossly incompetent developers that don't know what they are doing. This is not the first bug (nor I suspect the last bug) in their $800/seat/year editor.
The right thing here is to open a bug report on IntelliJ IDEA and get them to fix their "Leading IDE for Professional Development": https://youtrack.jetbrains.com/issues/IDEA
I have never seen this problem with any other editor, lsp, etc.
</rant>
Fixes #5212 (well works around IntelliJ's bug but what are you gonna do 🤷♀️)
Contributor Checklist
docs/src?Type of Improvement
Desired Merge Strategy
Release Notes
This works around a bug in IntelliJ which assumes that $ signifies an inner class and thus it does not properly find public APIs defined in these traits.
Reviewer Checklist (only modified by reviewer)
3.6.x,5.x, or6.xdepending on impact, API modification or big change:7.0)?Enable auto-merge (squash)and clean up the commit message.Create a merge commit.