Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide user source locators in Builder.error errors (bp #1618) #1619

Merged
merged 3 commits into from
Nov 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions chiselFrontend/src/main/scala/chisel3/internal/Error.scala
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ private[chisel3] class ErrorLog {
val chiselPrefixes = Set(
"java.",
"scala.",
"chisel3.",
"chisel3.internal.",
"chisel3.experimental.",
"chisel3.package$" // for some compatibility / deprecated types
Expand Down
13 changes: 13 additions & 0 deletions src/test/scala/chiselTests/stage/ChiselMainSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ object ChiselMainSpec {
require(false)
}

/** A module that triggers a Builder.error (as opposed to exception) */
class BuilderErrorModule extends RawModule {
val w = Wire(UInt(8.W))
w(3, -1)
}
}

class ChiselMainSpec extends FeatureSpec with GivenWhenThen with Matchers with chiselTests.Utils {
Expand Down Expand Up @@ -131,5 +136,13 @@ class ChiselMainSpec extends FeatureSpec with GivenWhenThen with Matchers with c
result = 1)
).foreach(runStageExpectFiles)
}
feature("Builder.error source locator") {
Seq(
ChiselMainTest(args = Array("-X", "none"),
generator = Some(classOf[BuilderErrorModule]),
stdout = Some("ChiselMainSpec.scala:29: Invalid bit range (3,-1) in class chiselTests.stage.ChiselMainSpec$BuilderErrorModule"),
result = 1)
).foreach(runStageExpectFiles)
}

}