summaryrefslogtreecommitdiff
path: root/src/test/scala/chiselTests
diff options
context:
space:
mode:
authormergify[bot]2022-01-26 19:52:36 +0000
committerGitHub2022-01-26 19:52:36 +0000
commitdb0fe3fb23c3f50be0aeb859b19cb96967e15186 (patch)
tree44b12e6c4b67df118194f0bcda2dcbbf49d57712 /src/test/scala/chiselTests
parenta737281f670aa34152ce971b57f926ecc9307a8c (diff)
Expand supported val modifiers for @public (#2365) (#2367)
(cherry picked from commit 13fb4595b3b21beadaad5ba5c5d131138099d6e1) Co-authored-by: Adam Izraelevitz <adam.izraelevitz@sifive.com>
Diffstat (limited to 'src/test/scala/chiselTests')
-rw-r--r--src/test/scala/chiselTests/experimental/hierarchy/InstanceSpec.scala22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/test/scala/chiselTests/experimental/hierarchy/InstanceSpec.scala b/src/test/scala/chiselTests/experimental/hierarchy/InstanceSpec.scala
index f62d1e49..45d1f85f 100644
--- a/src/test/scala/chiselTests/experimental/hierarchy/InstanceSpec.scala
+++ b/src/test/scala/chiselTests/experimental/hierarchy/InstanceSpec.scala
@@ -298,6 +298,28 @@ class InstanceSpec extends ChiselFunSpec with Utils {
annos should contain(MarkAnnotation("~Top|Top/i:HasEither>x".rt, "xright"))
annos should contain(MarkAnnotation("~Top|Top/i:HasEither>y".rt, "yleft"))
}
+ it("3.12: should properly support val modifiers") {
+ class SupClass extends Module {
+ val value = 10
+ val overriddenVal = 10
+ }
+ trait SupTrait {
+ def x: Int
+ def y: Int
+ }
+ @instantiable class SubClass() extends SupClass with SupTrait {
+ // This errors
+ //@public private val privateVal = 10
+ // This errors
+ //@public protected val protectedVal = 10
+ @public override val overriddenVal = 12
+ @public final val finalVal = 12
+ @public lazy val lazyValue = 12
+ @public val value = value
+ @public final override lazy val x: Int = 3
+ @public override final lazy val y: Int = 4
+ }
+ }
}
describe("4: toInstance") {
it("4.0: should work on modules") {