chipsalliance / chipsalliance/chisel

Objects extending Bundle give incorrect error messages

Open
#2,378 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
Scala
Stars
4.8k
Forks
658
Avg merge
18h 59m
Merged PRs (30d)
14

Description

It's incorrect for an object to extend Bundle, but it gives a truly weird error message:
```scala
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$.(main.scala:5)
at Playground$ObjectBundle$.(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.(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?**

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the ObjectBundle example from the issue and inspect the Chisel compiler plugin's handling of objects extending Bundle. The change is complete when this invalid declaration produces a specific compile-time error instead of the misleading compiler-plugin assertion.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.