From 91f20ccbe1dc1d6dccd06247e39e6bc607517e32 Mon Sep 17 00:00:00 2001 From: Chick Markley Date: Thu, 27 Jul 2017 11:10:17 -0700 Subject: Fix style of literal creators (#637) * Fix style of literal creators Literal creators for UInt, SInt and Bool were declared with parens, but virtually all uses of these methods do not use parens. This is for issue #539. This fix is an API breaking change. If anyone has used parens, e.g. val x = 1.U() This will now be an error * remove trailing parens from literal creators in IntegerMathTester --- chiselFrontend/src/main/scala/chisel3/core/package.scala | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'chiselFrontend') diff --git a/chiselFrontend/src/main/scala/chisel3/core/package.scala b/chiselFrontend/src/main/scala/chisel3/core/package.scala index aec5398d..e4a60329 100644 --- a/chiselFrontend/src/main/scala/chisel3/core/package.scala +++ b/chiselFrontend/src/main/scala/chisel3/core/package.scala @@ -26,10 +26,10 @@ package chisel3 { implicit class fromBigIntToLiteral(val bigint: BigInt) { /** Int to UInt conversion, recommended style for constants. */ - def U(): UInt = UInt.Lit(bigint, Width()) // scalastyle:ignore method.name + def U: UInt = UInt.Lit(bigint, Width()) // scalastyle:ignore method.name /** Int to SInt conversion, recommended style for constants. */ - def S(): SInt = SInt.Lit(bigint, Width()) // scalastyle:ignore method.name + def S: SInt = SInt.Lit(bigint, Width()) // scalastyle:ignore method.name /** Int to UInt conversion with specified width, recommended style for constants. */ def U(width: Width): UInt = UInt.Lit(bigint, width) // scalastyle:ignore method.name @@ -57,7 +57,7 @@ package chisel3 { implicit class fromStringToLiteral(val str: String) { /** String to UInt parse, recommended style for constants. */ - def U(): UInt = str.asUInt() // scalastyle:ignore method.name + def U: UInt = str.asUInt() // scalastyle:ignore method.name /** String to UInt parse with specified width, recommended style for constants. */ def U(width: Width): UInt = str.asUInt(width) // scalastyle:ignore method.name @@ -88,7 +88,7 @@ package chisel3 { implicit class fromBooleanToLiteral(val boolean: Boolean) { /** Boolean to Bool conversion, recommended style for constants. */ - def B(): Bool = Bool.Lit(boolean) // scalastyle:ignore method.name + def B: Bool = Bool.Lit(boolean) // scalastyle:ignore method.name /** Boolean to Bool conversion, recommended style for variables. */ -- cgit v1.2.3