diff --git a/build.sbt b/build.sbt index 647bf471..99baeeb1 100644 --- a/build.sbt +++ b/build.sbt @@ -729,7 +729,7 @@ lazy val commonSettings = Seq[Setting[_]]( "-Xsource:3-cross", "-Wnonunit-statement", "-Wvalue-discard", - ) ++ (if (assertionsEnabled.value) Nil else List("-Xelide-below", "2001")) + ) ++ (if (assertionsEnabled.value) Nil else List("-Xelide-below", "1501")) } else { // 3.x: List( diff --git a/internal-helpers/src/test/scala-2.13/dev/tauri/choam/helpers/ChoamUtils2.scala b/internal-helpers/src/test/scala-2.13/dev/tauri/choam/helpers/ChoamUtils2.scala index 8aef2dc5..bc92ef4a 100644 --- a/internal-helpers/src/test/scala-2.13/dev/tauri/choam/helpers/ChoamUtils2.scala +++ b/internal-helpers/src/test/scala-2.13/dev/tauri/choam/helpers/ChoamUtils2.scala @@ -25,7 +25,7 @@ import scala.annotation.{ elidable, nowarn } @nowarn("msg=elidable") private[choam] abstract class ChoamUtils2 { - @elidable(elidable.ASSERTION) + @elidable(1500) private[choam] final def _assert(ok: Boolean): Unit = { if (!ok) { throw new AssertionError diff --git a/internal-helpers/src/test/scala-2.13/dev/tauri/choam/helpers/DisableAssertionsSpecScala213.scala b/internal-helpers/src/test/scala-2.13/dev/tauri/choam/helpers/DisableAssertionsSpecScala213.scala deleted file mode 100644 index 432f613a..00000000 --- a/internal-helpers/src/test/scala-2.13/dev/tauri/choam/helpers/DisableAssertionsSpecScala213.scala +++ /dev/null @@ -1,27 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * Copyright 2016-2024 Daniel Urban and contributors listed in NOTICE.txt - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package dev.tauri.choam -package helpers - -final class DisableAssertionsSpecScala213 extends BaseSpec { - - test("The Scala 2.13 `-Xelide-below` also affects Predef.assert") { - Predef.assert(false) - Predef.assert(false, "foo") - } -} diff --git a/internal-helpers/src/test/scala/dev/tauri/choam/helpers/DisabledAssertionsSpec.scala b/internal-helpers/src/test/scala/dev/tauri/choam/helpers/DisabledAssertionsSpec.scala index 11724789..e00eec82 100644 --- a/internal-helpers/src/test/scala/dev/tauri/choam/helpers/DisabledAssertionsSpec.scala +++ b/internal-helpers/src/test/scala/dev/tauri/choam/helpers/DisabledAssertionsSpec.scala @@ -25,15 +25,23 @@ final class DisableAssertionsSpec extends BaseSpec { _assert({ throw new Exception; false }) : @nowarn("cat=w-flag-dead-code") } + test("Predef.assert should still work".fail) { + Predef.assert(false) + } + + test("Predef.assert should still work (with message)".fail) { + Predef.assert(false, "foo") + } + test("munit assert should still work".fail) { this.assert(false) } - test("require(Boolean) should still work".fail) { + test("require should still work".fail) { require(false) } - test("require(Boolean, => Any) should still work".fail) { + test("require should still work (with message)".fail) { require(false, "foo") } diff --git a/skiplist/shared/src/main/scala-2.13/dev/tauri/choam/internal/ChoamUtils.scala b/skiplist/shared/src/main/scala-2.13/dev/tauri/choam/internal/ChoamUtils.scala index 0d3467e1..d79b876a 100644 --- a/skiplist/shared/src/main/scala-2.13/dev/tauri/choam/internal/ChoamUtils.scala +++ b/skiplist/shared/src/main/scala-2.13/dev/tauri/choam/internal/ChoamUtils.scala @@ -24,7 +24,7 @@ import scala.annotation.{ elidable, nowarn } @nowarn("msg=elidable") private[choam] abstract class ChoamUtils { - @elidable(elidable.ASSERTION) + @elidable(1500) private[choam] final def _assert(ok: Boolean): Unit = { if (!ok) { throw new AssertionError