File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -24,4 +24,18 @@ object DottyPredef {
2424 * `discardForView` from two to one.
2525 */
2626 abstract class ImplicitConverter [- T , + U ] extends Function1 [T , U ]
27+
28+ @ inline final def assert (assertion : Boolean , message : => Any ): Unit = {
29+ if (! assertion)
30+ assertFail(message)
31+ }
32+
33+ @ inline final def assert (assertion : Boolean ): Unit = {
34+ if (! assertion)
35+ assertFail()
36+ }
37+
38+ final def assertFail (): Unit = throw new java.lang.AssertionError (" assertion failed" )
39+ final def assertFail (message : => Any ): Unit = throw new java.lang.AssertionError (" assertion failed: " + message)
40+
2741}
Original file line number Diff line number Diff line change 11import Predef .{assert => _ }
2+ import dotty .DottyPredef .{assert => _ }
23
34object Test {
45 assert(" asdf" == " asdf" ) // error: not found assert
You can’t perform that action at this time.
0 commit comments