From a4388d32052c3bb64d643ebd6e46b5068f540340 Mon Sep 17 00:00:00 2001 From: Aditya Naik Date: Wed, 27 May 2026 17:41:09 -0700 Subject: [PATCH 1/3] Move ConnectableSpec --- .../{scala-2 => scala}/chiselTests/ConnectableSpec.scala | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) rename src/test/{scala-2 => scala}/chiselTests/ConnectableSpec.scala (99%) diff --git a/src/test/scala-2/chiselTests/ConnectableSpec.scala b/src/test/scala/chiselTests/ConnectableSpec.scala similarity index 99% rename from src/test/scala-2/chiselTests/ConnectableSpec.scala rename to src/test/scala/chiselTests/ConnectableSpec.scala index 71ca0168b08..39793c33eed 100644 --- a/src/test/scala-2/chiselTests/ConnectableSpec.scala +++ b/src/test/scala/chiselTests/ConnectableSpec.scala @@ -1847,8 +1847,9 @@ class ConnectableSpec extends AnyFunSpec with Matchers { val e = intercept[ChiselException] { ChiselStage.emitCHIRRTL(new MyModule, args = Array("--throw-on-first-error")) } - e.getMessage should include( - "mismatched widths of .out: IO[UInt<4>] and .in: IO[UInt<8>] might require truncation of .in: IO[UInt<8>]" + // names show up as `null` in Scala 3 and `` in Scala 2 + e.getMessage should include regex( + "mismatched widths of .* and .* might require truncation of .*" ) } } From 8013608dc10463d5e0a6fbf8d0f7eaddec320a79 Mon Sep 17 00:00:00 2001 From: Aditya Naik Date: Wed, 27 May 2026 17:47:06 -0700 Subject: [PATCH 2/3] Formatting --- src/test/scala/chiselTests/ConnectableSpec.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/scala/chiselTests/ConnectableSpec.scala b/src/test/scala/chiselTests/ConnectableSpec.scala index 39793c33eed..cebc89caf2b 100644 --- a/src/test/scala/chiselTests/ConnectableSpec.scala +++ b/src/test/scala/chiselTests/ConnectableSpec.scala @@ -1848,7 +1848,7 @@ class ConnectableSpec extends AnyFunSpec with Matchers { ChiselStage.emitCHIRRTL(new MyModule, args = Array("--throw-on-first-error")) } // names show up as `null` in Scala 3 and `` in Scala 2 - e.getMessage should include regex( + (e.getMessage should include).regex( "mismatched widths of .* and .* might require truncation of .*" ) } From b65fe2aa981e86f97ea11673dea5f55bfee437f5 Mon Sep 17 00:00:00 2001 From: Aditya Naik Date: Fri, 29 May 2026 17:47:13 -0700 Subject: [PATCH 3/3] Update propsed name to handle Scala 3 null values Revert test changes --- core/src/main/scala/chisel3/Module.scala | 18 +++++++++++++----- .../scala/chiselTests/ConnectableSpec.scala | 5 ++--- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/core/src/main/scala/chisel3/Module.scala b/core/src/main/scala/chisel3/Module.scala index cf09e5b2458..84b9c85db0a 100644 --- a/core/src/main/scala/chisel3/Module.scala +++ b/core/src/main/scala/chisel3/Module.scala @@ -714,11 +714,19 @@ package experimental { * * Includes the module prefix for user-defined modules (but not for blackboxes). */ - private[chisel3] def _proposedName: String = this match { - // PseudoModules (e.g. Instances) and BlackBoxes have their names set by desiredName. - case _: PseudoModule => desiredName - case _: BaseBlackBox => desiredName - case _ => this.modulePrefix + desiredName + private[chisel3] def _proposedName: String = { + val dn = desiredName + // Handle Scala 3 null values + if (dn == null) + throw new NullPointerException( + s"desiredName of ${this.getClass.getName} is null" + ) + this match { + // PseudoModules (e.g. Instances) and BlackBoxes have their names set by desiredName. + case _: PseudoModule => dn + case _: BaseBlackBox => dn + case _ => this.modulePrefix + dn + } } /** Legalized name of this module. */ diff --git a/src/test/scala/chiselTests/ConnectableSpec.scala b/src/test/scala/chiselTests/ConnectableSpec.scala index cebc89caf2b..71ca0168b08 100644 --- a/src/test/scala/chiselTests/ConnectableSpec.scala +++ b/src/test/scala/chiselTests/ConnectableSpec.scala @@ -1847,9 +1847,8 @@ class ConnectableSpec extends AnyFunSpec with Matchers { val e = intercept[ChiselException] { ChiselStage.emitCHIRRTL(new MyModule, args = Array("--throw-on-first-error")) } - // names show up as `null` in Scala 3 and `` in Scala 2 - (e.getMessage should include).regex( - "mismatched widths of .* and .* might require truncation of .*" + e.getMessage should include( + "mismatched widths of .out: IO[UInt<4>] and .in: IO[UInt<8>] might require truncation of .in: IO[UInt<8>]" ) } }