From b3d4654935db38990d6cc4976eed7ddc14cf60fd Mon Sep 17 00:00:00 2001 From: Albert Magyar Date: Mon, 9 Mar 2020 20:00:27 -0700 Subject: Check for module name conflicts * Fixes #1436 --- src/test/scala/firrtlTests/CheckSpec.scala | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/test') diff --git a/src/test/scala/firrtlTests/CheckSpec.scala b/src/test/scala/firrtlTests/CheckSpec.scala index 9a384d21..f03b6611 100644 --- a/src/test/scala/firrtlTests/CheckSpec.scala +++ b/src/test/scala/firrtlTests/CheckSpec.scala @@ -307,6 +307,32 @@ class CheckSpec extends FlatSpec with Matchers { } } } + + s"Duplicate module names" should "throw an exception" in { + val input = + s"""|circuit bar : + | module bar : + | input i : UInt<8> + | output o : UInt<8> + | o <= i + | module dup : + | input i : UInt<8> + | output o : UInt<8> + | o <= i + | module dup : + | input i : UInt<8> + | output o : UInt<8> + | o <= not(i) + |""".stripMargin + assertThrows[CheckHighForm.ModuleNameNotUniqueException] { + try { + checkHighInput(input) + } catch { + case e: firrtl.passes.PassExceptions => throw e.exceptions.head + } + } + } + } object CheckSpec { -- cgit v1.2.3