Skip to content

Commit 4a52b10

Browse files
committed
Elide message def binding if not used
This also reduces sligttly the size of the if it is used. Also make `assertFail` private.
1 parent 68e2023 commit 4a52b10

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

library/src/dotty/DottyPredef.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@ package dotty
33
object DottyPredef {
44
import compiletime.summonFrom
55

6-
inline final def assert(assertion: => Boolean, message: => Any): Unit = {
6+
inline final def assert(inline assertion: Boolean, inline message: => Any): Unit = {
77
if (!assertion)
88
assertFail(message)
99
}
1010

11-
inline final def assert(inline assertion: => Boolean) <: Unit = {
11+
inline final def assert(inline assertion: Boolean): Unit = {
1212
if (!assertion)
1313
assertFail()
1414
}
1515

16-
def assertFail(): Nothing = throw new java.lang.AssertionError("assertion failed")
17-
def assertFail(message: => Any): Nothing = throw new java.lang.AssertionError("assertion failed: " + message)
16+
private def assertFail(): Nothing = throw new java.lang.AssertionError("assertion failed")
17+
private def assertFail(message: => Any): Nothing = throw new java.lang.AssertionError("assertion failed: " + message)
1818

1919
inline final def implicitly[T](implicit ev: T): T = ev
2020

0 commit comments

Comments
 (0)