summaryrefslogtreecommitdiff
path: root/chiselFrontend/src/main/scala/chisel3/core/Module.scala
diff options
context:
space:
mode:
authorRichard Lin2018-02-08 10:50:35 -0800
committerGitHub2018-02-08 10:50:35 -0800
commita57e4b1ea0970266aae8ce3bb5edaaf605057035 (patch)
treee14f8e70b67829708216ce329e0e84f5a8823525 /chiselFrontend/src/main/scala/chisel3/core/Module.scala
parent254597c125bda06e041a4a241177e959200ce8f7 (diff)
Make uncloneable IO deprecated instead of error, improve error handling (#771)
It appears #754 breaks more code than I thought, so this makes it a soft error (with a runtime deprecation warning - to get people to fix their stuff before we break it for real) for now. This additionally changes the autoclonetype errors to be more deterministic (reporting class names instead of object names) in the most common cases, to allow the deprecations manager to deduplicate warnings.
Diffstat (limited to 'chiselFrontend/src/main/scala/chisel3/core/Module.scala')
-rw-r--r--chiselFrontend/src/main/scala/chisel3/core/Module.scala9
1 files changed, 8 insertions, 1 deletions
diff --git a/chiselFrontend/src/main/scala/chisel3/core/Module.scala b/chiselFrontend/src/main/scala/chisel3/core/Module.scala
index 74479c6b..5ba6dbc8 100644
--- a/chiselFrontend/src/main/scala/chisel3/core/Module.scala
+++ b/chiselFrontend/src/main/scala/chisel3/core/Module.scala
@@ -255,7 +255,14 @@ abstract class BaseModule extends HasId {
requireIsChiselType(iodef, "io type")
// Clone the IO so we preserve immutability of data types
- val iodefClone = iodef.cloneTypeFull
+ val iodefClone = try {
+ iodef.cloneTypeFull
+ } catch {
+ // For now this is going to be just a deprecation so we don't suddenly break everyone's code
+ case e: AutoClonetypeException =>
+ Builder.deprecated(e.getMessage, Some(s"${iodef.getClass}"))
+ iodef
+ }
_bindIoInPlace(iodefClone)
iodefClone
}