diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-01-04 12:54:28 -0800 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-01-04 12:54:28 -0800 |
commit | ed4f4798df2ac104d9557de2241d8e89283b0662 (patch) | |
tree | ace96d15208ee78681515c9091599828dab08589 /src/compiler/scala/tools | |
parent | 5a2107d1745af3386300e4a3f7617cad4b6b2779 (diff) | |
parent | b2bd8253663056be265af4cb1788b852fc627fa2 (diff) | |
download | scala-ed4f4798df2ac104d9557de2241d8e89283b0662.tar.gz scala-ed4f4798df2ac104d9557de2241d8e89283b0662.tar.bz2 scala-ed4f4798df2ac104d9557de2241d8e89283b0662.zip |
Merge pull request #1830 from magarciaEPFL/unnest-closures-supplementErrorMessage
nested closures are flattened by calling supplementErrorMessage() directly
Diffstat (limited to 'src/compiler/scala/tools')
-rw-r--r-- | src/compiler/scala/tools/nsc/Global.scala | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala index 95da7324aa..8746a7fd8d 100644 --- a/src/compiler/scala/tools/nsc/Global.scala +++ b/src/compiler/scala/tools/nsc/Global.scala @@ -228,13 +228,17 @@ class Global(var currentSettings: Settings, var reporter: Reporter) // of assert and require (but for now I've reproduced them here, // because there are a million to fix.) @inline final def assert(assertion: Boolean, message: => Any) { - Predef.assert(assertion, supplementErrorMessage("" + message)) + // calling Predef.assert would send a freshly allocated closure wrapping the one received as argument. + if (!assertion) + throw new java.lang.AssertionError("assertion failed: "+ supplementErrorMessage("" + message)) } @inline final def assert(assertion: Boolean) { assert(assertion, "") } @inline final def require(requirement: Boolean, message: => Any) { - Predef.require(requirement, supplementErrorMessage("" + message)) + // calling Predef.require would send a freshly allocated closure wrapping the one received as argument. + if (!requirement) + throw new IllegalArgumentException("requirement failed: "+ supplementErrorMessage("" + message)) } @inline final def require(requirement: Boolean) { require(requirement, "") |