summaryrefslogtreecommitdiff
path: root/src/test/scala
diff options
context:
space:
mode:
authorJack Koenig2018-07-31 15:43:54 -0700
committerGitHub2018-07-31 15:43:54 -0700
commit4de6848ef746ca40945dc95a113e820bc7265cea (patch)
treed9ffbb7f9c118ebc0eb8f40d6ec64b626dcad7d5 /src/test/scala
parent64a8f52c48905e9bf28e709cde2de89215a35c80 (diff)
Cleanup implicit conversions (#868)
Diffstat (limited to 'src/test/scala')
-rw-r--r--src/test/scala/chiselTests/ImplicitConversionsSpec.scala43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/test/scala/chiselTests/ImplicitConversionsSpec.scala b/src/test/scala/chiselTests/ImplicitConversionsSpec.scala
new file mode 100644
index 00000000..d5939b24
--- /dev/null
+++ b/src/test/scala/chiselTests/ImplicitConversionsSpec.scala
@@ -0,0 +1,43 @@
+// See LICENSE for license details.
+
+package chiselTests
+
+import chisel3._
+
+class ImplicitConversionsSpec extends ChiselFlatSpec {
+ ".data on arbitrary Data objects" should "not work" in {
+ assertTypeError("UInt(8.W).data")
+ assertTypeError("8.S.data")
+ assertTypeError("(new Bundle {}).data")
+ assertTypeError("VecInit(1.U).data")
+ }
+
+ ".target on arbitrary Data objects" should "not work" in {
+ assertTypeError("UInt(8.W).target")
+ assertTypeError("8.S.target")
+ assertTypeError("(new Bundle {}).target")
+ assertTypeError("VecInit(1.U).target")
+ }
+
+ ".x on Strings and Numerical values" should "not work" in {
+ assertTypeError("3.x")
+ assertTypeError("3L.x")
+ assertTypeError("BigInt(-4).x")
+ assertTypeError("false.x")
+ assertTypeError(""""a".x""")
+ }
+
+ ".bigint on Strings and Numerical values" should "not work" in {
+ assertTypeError("3.bigint")
+ assertTypeError("3L.bigint")
+ assertTypeError("BigInt(-4).bigint")
+ assertTypeError("false.bigint")
+ assertTypeError(""""a".bigint""")
+ }
+
+ ".target on DecoupledIO" should "not work" in {
+ import chisel3.util._
+ assertTypeError("Decoupled(UInt(8.W)).target")
+ }
+}
+