diff options
| author | Jack Koenig | 2020-09-21 19:34:43 -0700 |
|---|---|---|
| committer | GitHub | 2020-09-22 02:34:43 +0000 |
| commit | 9c4f14fb7347b5ca6afe777a9a4c5d9d15f9ac0d (patch) | |
| tree | c21b72e902de8cb8660125e8baf39e0c94f8546c /src | |
| parent | c613c285c3e044370024a1b5cc0a0da1dbc3e5e6 (diff) | |
Support using switch without importing SwitchContext (#1595)
Diffstat (limited to 'src')
| -rw-r--r-- | src/main/scala/chisel3/util/Conditional.scala | 2 | ||||
| -rw-r--r-- | src/test/scala/chiselTests/SwitchSpec.scala | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/main/scala/chisel3/util/Conditional.scala b/src/main/scala/chisel3/util/Conditional.scala index 4938d075..e9d216f5 100644 --- a/src/main/scala/chisel3/util/Conditional.scala +++ b/src/main/scala/chisel3/util/Conditional.scala @@ -94,7 +94,7 @@ object switch { def apply[T <: Element](cond: T)(x: => Any): Unit = macro impl def impl(c: Context)(cond: c.Tree)(x: c.Tree): c.Tree = { import c.universe._ val q"..$body" = x - val res = body.foldLeft(q"""new SwitchContext($cond, None, Set.empty)""") { + val res = body.foldLeft(q"""new chisel3.util.SwitchContext($cond, None, Set.empty)""") { case (acc, tree) => tree match { // TODO: remove when Chisel compatibility package is removed case q"Chisel.`package`.is.apply( ..$params )( ..$body )" => q"$acc.is( ..$params )( ..$body )" diff --git a/src/test/scala/chiselTests/SwitchSpec.scala b/src/test/scala/chiselTests/SwitchSpec.scala index 79849c76..90287cdd 100644 --- a/src/test/scala/chiselTests/SwitchSpec.scala +++ b/src/test/scala/chiselTests/SwitchSpec.scala @@ -4,7 +4,7 @@ package chiselTests import chisel3._ import chisel3.stage.ChiselStage -import chisel3.util._ +import chisel3.util.{switch, is} class SwitchSpec extends ChiselFlatSpec with Utils { "switch" should "require literal conditions" in { |
