From c3b06d773f1fabd2519d6c705d68381d13f1c07f Mon Sep 17 00:00:00 2001 From: Zachary Yedidia Date: Tue, 23 Aug 2022 17:20:12 -0700 Subject: Backport .toTarget deprecation warning information (3.5.x) (#2697) --- core/src/main/scala/chisel3/internal/Builder.scala | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'core/src') diff --git a/core/src/main/scala/chisel3/internal/Builder.scala b/core/src/main/scala/chisel3/internal/Builder.scala index 07d8e7f7..07fc80eb 100644 --- a/core/src/main/scala/chisel3/internal/Builder.scala +++ b/core/src/main/scala/chisel3/internal/Builder.scala @@ -249,10 +249,20 @@ private[chisel3] trait HasId extends InstanceId { // Builder.deprecated mechanism, we have to create our own one off ErrorLog and print the // warning right away. // It's especially bad because --warnings-as-errors does not work with these warnings + val nameGuess = _computeName(None) match { + case Some(name) => s": '$name'" + case None => "" + } + val parentGuess = _parent match { + case Some(ViewParent) => s", in module '${reifyParent.pathName}'" + case Some(p) => s", in module '${p.pathName}'" + case None => "" + } val errors = new ErrorLog(false) val logger = new _root_.logger.Logger(this.getClass.getName) - val msg = "Accessing the .instanceName or .toTarget of non-hardware Data is deprecated. " + - "This will become an error in Chisel 3.6." + val msg = + "Accessing the .instanceName or .toTarget of non-hardware Data is deprecated" + nameGuess + parentGuess + ". " + + "This will become an error in Chisel 3.6." errors.deprecated(msg, None) errors.checkpoint(logger) _computeName(None).get -- cgit v1.2.3