Skip to content

Rename all object interface traits, $ => Obj#5274

Merged
jackkoenig merged 4 commits into
mainfrom
jackkoenig/rename-object-interfact-traits
Apr 17, 2026
Merged

Rename all object interface traits, $ => Obj#5274
jackkoenig merged 4 commits into
mainfrom
jackkoenig/rename-object-interfact-traits

Conversation

@jackkoenig
Copy link
Copy Markdown
Contributor

Fixes #5212 (well works around IntelliJ's bug but what are you gonna do 🤷‍♀️)

Contributor Checklist

  • Did you add Scaladoc to every public function/method?
  • Did you add at least one test demonstrating the PR?
  • Did you delete any extraneous printlns/debugging code?
  • Did you specify the type of improvement?
  • Did you add appropriate documentation in docs/src?
  • Did you request a desired merge strategy?
  • Did you add text to be included in the Release Notes for this change?

Type of Improvement

  • Bugfix

Desired Merge Strategy

  • Squash

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)

  • Did you add the appropriate labels? (Select the most appropriate one based on the "Type of Improvement")
  • Did you mark the proper milestone (Bug fix: 3.6.x, 5.x, or 6.x depending on impact, API modification or big change: 7.0)?
  • Did you review?
  • Did you check whether all relevant Contributor checkboxes have been checked?
  • Did you do one of the following when ready to merge:
    • Squash: You/ the contributor Enable auto-merge (squash) and clean up the commit message.
    • Merge: Ensure that contributor has cleaned up their commit history, then merge with Create a merge commit.

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.
@jackkoenig jackkoenig requested a review from seldridge April 16, 2026 21:45
@jackkoenig jackkoenig added the Bugfix Fixes a bug, will be included in release notes label Apr 16, 2026
Comment thread release.mill Outdated
Comment on lines +103 to +104
ProblemFilter.exclude[IncompatibleResultTypeProblem]("chisel3.util.BitPat.fromUIntToBitPatComparable"),
ProblemFilter.exclude[IncompatibleResultTypeProblem]("chisel3.util.BitPat.fromUIntToBitPatComparable")
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@jackkoenig jackkoenig force-pushed the jackkoenig/rename-object-interfact-traits branch from abdd5d5 to efd55bb Compare April 16, 2026 22:41
Comment thread src/main/scala-3/chisel3/util/BitPatIntf.scala Outdated
Copy link
Copy Markdown
Member

@seldridge seldridge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>

@jackkoenig jackkoenig merged commit e0591f4 into main Apr 17, 2026
28 checks passed
@jackkoenig jackkoenig deleted the jackkoenig/rename-object-interfact-traits branch April 17, 2026 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bugfix Fixes a bug, will be included in release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants