summaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authorJack Koenig2021-03-15 16:55:06 -0700
committerGitHub2021-03-15 16:55:06 -0700
commit96436ae018b3631decb8384ce404ada0daa5d645 (patch)
tree4d27eeddbfb96fee1843015aaecb91d7334ab45b /core/src
parentb3592a4973a50098f71e0e64bf3f0f53a82a82e9 (diff)
allowReflectiveAutoCloneType must work outside of Builder context (#1811)
Diffstat (limited to 'core/src')
-rw-r--r--core/src/main/scala/chisel3/internal/Builder.scala8
1 files changed, 6 insertions, 2 deletions
diff --git a/core/src/main/scala/chisel3/internal/Builder.scala b/core/src/main/scala/chisel3/internal/Builder.scala
index b1016a2e..084bdc88 100644
--- a/core/src/main/scala/chisel3/internal/Builder.scala
+++ b/core/src/main/scala/chisel3/internal/Builder.scala
@@ -532,8 +532,12 @@ private[chisel3] object Builder extends LazyLogging {
dynamicContext.currentReset = newReset
}
- // This should only be used for testing
- def allowReflectiveAutoCloneType: Boolean = dynamicContext.allowReflectiveAutoCloneType
+ // This should only be used for testing, must be true outside of Builder context
+ def allowReflectiveAutoCloneType: Boolean = {
+ dynamicContextVar.value
+ .map(_.allowReflectiveAutoCloneType)
+ .getOrElse(true)
+ }
def allowReflectiveAutoCloneType_=(value: Boolean): Unit = {
dynamicContext.allowReflectiveAutoCloneType = value
}