From e41936d5283ba8caae2a23602e8e1a2baea391cb Mon Sep 17 00:00:00 2001 From: Albert Magyar Date: Mon, 9 Mar 2020 20:02:06 -0700 Subject: Check for collision of defnames with Module names * Fixes #1096 --- src/test/scala/firrtlTests/CheckSpec.scala | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/test') diff --git a/src/test/scala/firrtlTests/CheckSpec.scala b/src/test/scala/firrtlTests/CheckSpec.scala index f03b6611..aa154bab 100644 --- a/src/test/scala/firrtlTests/CheckSpec.scala +++ b/src/test/scala/firrtlTests/CheckSpec.scala @@ -333,6 +333,23 @@ class CheckSpec extends FlatSpec with Matchers { } } + s"Defnames that conflict with pure-FIRRTL module names" should "throw an exception" in { + val input = + s"""|circuit bar : + | module bar : + | input i : UInt<8> + | output o : UInt<8> + | o <= i + | extmodule dup : + | input i : UInt<8> + | output o : UInt<8> + | defname = bar + |""".stripMargin + assertThrows[CheckHighForm.DefnameConflictException] { + checkHighInput(input) + } + } + } object CheckSpec { -- cgit v1.2.3