summaryrefslogtreecommitdiff
path: root/no-plugin-tests/src/test/scala/chiselTests/NoPluginBundleSpec.scala
blob: b73be4831c30516e2eb74ca6e3ec489fe9cc4944 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// SPDX-License-Identifier: Apache-2.0

package chiselTests

import chisel3._
import chisel3.stage.ChiselStage
import chisel3.testers.BasicTester



trait BundleSpecUtils {
  
  class BundleBaz(val w: Int) extends Bundle {
    val baz = UInt(w.W)
    // (if we don't have the val on the val w: Int then it is an Exception)
    // Check that we get a runtime deprecation warning if we don't have this:
    // override def cloneType = (new BundleBaz(w)).asInstanceOf[this.type]
  }

}

class NoPluginBundleSpec extends ChiselFlatSpec with BundleSpecUtils with Utils {

 "No override def cloneType" should "give a runtime deprecation warning without compiler plugin" in {
    class MyModule extends MultiIOModule {
      val in = IO(Input(new BundleBaz(w = 3)))
      val out = IO(Output(in.cloneType))
    }
    val (log, _) = grabLog(
        ChiselStage.elaborate(new MyModule())
    )
    log should include ("warn")
    log should include ("deprecated")
    log should include ("The runtime reflection inference for cloneType")
  }
}