chipsalliance / chisel

Chisel: A Modern Hardware Design Language
https://www.chisel-lang.org/
Apache License 2.0
3.95k stars 594 forks source link

Objects extending Bundle give incorrect error messages #2378

Open jackkoenig opened 2 years ago

jackkoenig commented 2 years ago

It's incorrect for an object to extend Bundle, but it gives a truly weird error message:

object ObjectBundle extends Bundle {
  val foo = UInt(8.W)
}

class Example extends Module {
  val in = IO(Input(ObjectBundle))
  val out = IO(Output(ObjectBundle))
  out := in
}

Gives:

java.lang.AssertionError: assertion failed: The Chisel compiler plugin is now required for compiling Chisel code. Please see https://github.com/chipsalliance/chisel3#build-your-own-chisel-projects.
    at ... ()
    at Playground$ObjectBundle$.<init>(main.scala:5)
    at Playground$ObjectBundle$.<clinit>(main.scala:5)
    at Playground$Example$$anonfun$2$$anonfun$apply$1.apply(main.scala:10)
    at Playground$Example$$anonfun$2$$anonfun$apply$1.apply(main.scala:10)
    at chisel3.internal.prefix$.apply(prefix.scala:48)
    at Playground$Example$$anonfun$2.apply(main.scala:10)
    at Playground$Example$$anonfun$2.apply(main.scala)
    at chisel3.internal.plugin.package$.autoNameRecursively(package.scala:33)
    at Playground$Example.<init>(main.scala:10)
    at Playground$$anonfun$5.apply(main.scala:16)
    at Playground$$anonfun$5.apply(main.scala:16)
    at ... ()
    at ... (Stack trace trimmed to user code only. Rerun with --full-stacktrace to see the full stack trace)

https://scastie.scala-lang.org/duach2TPTF6eQrZarKCPug

This should be pretty easy to pattern match and report a compile-time error on in the plugin.

Type of issue: bug report | feature request

Impact: no functional change

Development Phase: proposal

Other information

If the current behavior is a bug, please provide the steps to reproduce the problem:

What is the current behavior?

What is the expected behavior?

Please tell us about your environment:

What is the use case for changing the behavior?

tymcauley commented 2 months ago

Ha, I just ran into this same error and was about to file an issue for it, before I saw this one :P