Skip to content

(draft) Change signature of macro-based chisel3.Bits.unary_~ to fix IntelliJ highlighting issue #4611

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
8 changes: 7 additions & 1 deletion core/src/main/scala-2/chisel3/Bits.scala
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ private[chisel3] sealed trait ToBoolable extends Element {
*/
sealed abstract class Bits(private[chisel3] val width: Width) extends BitsImpl with ToBoolable {

type Self <: Bits

/** Tail operator
*
* @param n the number of bits to remove
Expand Down Expand Up @@ -170,7 +172,7 @@ sealed abstract class Bits(private[chisel3] val width: Width) extends BitsImpl w
* @return this $coll with each bit inverted
* @group Bitwise
*/
final def unary_~ : Bits = macro SourceInfoWhiteboxTransform.noArg
final def unary_~ : Self = macro SourceInfoWhiteboxTransform.noArg

/** @group SourceInfoTransformMacro */
def do_unary_~(implicit sourceInfo: SourceInfo): Bits = _impl_unary_~
Expand Down Expand Up @@ -293,6 +295,7 @@ object Bits extends UIntFactory
* @define constantWidth @note The width of the returned $coll is unchanged, i.e., `width of this`.
*/
sealed class UInt private[chisel3] (width: Width) extends Bits(width) with UIntImpl {
type Self = UInt

// TODO: refactor to share documentation with Num or add independent scaladoc
/** Unary negation (expanding width)
Expand Down Expand Up @@ -566,6 +569,7 @@ object UInt extends UIntFactory
* @define constantWidth @note The width of the returned $coll is unchanged, i.e., `width of this`.
*/
sealed class SInt private[chisel3] (width: Width) extends Bits(width) with SIntImpl {
override type Self = SInt

/** Unary negation (constant width)
*
Expand Down Expand Up @@ -807,6 +811,8 @@ sealed class AsyncReset(private[chisel3] val width: Width = Width(1)) extends As
* @define numType $coll
*/
sealed class Bool() extends UInt(1.W) with BoolImpl with Reset {
//Compiler fails with error
//override type Self = Bool

// REVIEW TODO: Why does this need to exist and have different conventions
// than Bits?
Expand Down
Loading