summaryrefslogtreecommitdiff
path: root/core/src/main/scala/chisel3/When.scala
diff options
context:
space:
mode:
authorJared Barocsi2021-10-05 12:33:23 -0700
committerGitHub2021-10-05 19:33:23 +0000
commit110705eeace4f9165dc6377e55c86a599f37a465 (patch)
tree4e6ed88311fd1ce08cebc0225868d2d103c6fae7 /core/src/main/scala/chisel3/When.scala
parentce15ad50a5c175db06c3bba5e3bf46b6c5466c47 (diff)
Deprecate auto-application of empty argument lists to parameterless functions (#2124)
* Migrate nullary funcs to parameterless versions * Make deprecation message and dummy arguments clear and consistent Co-authored-by: Megan Wachs <megan@sifive.com>
Diffstat (limited to 'core/src/main/scala/chisel3/When.scala')
-rw-r--r--core/src/main/scala/chisel3/When.scala9
1 files changed, 6 insertions, 3 deletions
diff --git a/core/src/main/scala/chisel3/When.scala b/core/src/main/scala/chisel3/When.scala
index a2c20d9a..ca383c0f 100644
--- a/core/src/main/scala/chisel3/When.scala
+++ b/core/src/main/scala/chisel3/When.scala
@@ -50,7 +50,7 @@ object when {
implicit val sourceInfo = UnlocatableSourceInfo
val whens = Builder.whenStack
whens.foldRight(true.B) {
- case (ctx, acc) => acc && ctx.localCond()
+ case (ctx, acc) => acc && ctx.localCond
}
}
}
@@ -81,7 +81,7 @@ final class WhenContext private[chisel3] (
private var scopeOpen = false
/** Returns the local condition, inverted for an otherwise */
- private[chisel3] def localCond(): Bool = {
+ private[chisel3] def localCond: Bool = {
implicit val compileOptions = ExplicitCompileOptions.Strict
implicit val sourceInfo = UnlocatableSourceInfo
val alt = altConds.foldRight(true.B) {
@@ -111,7 +111,10 @@ final class WhenContext private[chisel3] (
def otherwise(block: => Any)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Unit =
new WhenContext(sourceInfo, None, block, firrtlDepth + 1, cond ++: altConds)
- def active(): Boolean = scopeOpen
+ def active: Boolean = scopeOpen
+
+ @deprecated("Calling this function with an empty argument list is invalid in Scala 3. Use the form without parentheses instead", "Chisel 3.5")
+ def active(dummy: Int*): Boolean = active
/*
*