File tree Expand file tree Collapse file tree 3 files changed +14
-7
lines changed
compiler/src/dotty/tools/dotc/core
scala2-library-bootstrapped/src/scala Expand file tree Collapse file tree 3 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -1436,11 +1436,14 @@ class Definitions {
14361436 )
14371437
14381438 if patchCls.exists then
1439+ val patchedInSource = mutable.Set .empty[Symbol ] // example: symbol patched in scala2-library-bootstrapped/src/scala/Predef.scala
14391440 val patches = patchCls.info.decls.filter(patch =>
14401441 ! patch.isConstructor && ! patch.isOneOf(PrivateOrSynthetic ))
14411442 for patch <- patches if ! recurse(patch) do
14421443 val e = scope.lookupEntry(patch.name)
1443- if e != null then scope.unlink(e)
1444+ if e != null then
1445+ if e.sym.isInlineMethod then patchedInSource += patch
1446+ else scope.unlink(e)
14441447 for patch <- patches do
14451448 patch.ensureCompleted()
14461449 if ! recurse(patch) then
@@ -1451,8 +1454,9 @@ class Definitions {
14511454 case _ =>
14521455 makeNonClassSymbol(patch)
14531456 end match
1454- sym.annotations = patch.annotations
1455- scope.enter(sym)
1457+ if ! patchedInSource(sym) then
1458+ sym.annotations = patch.annotations
1459+ scope.enter(sym)
14561460 if patch.isClass then
14571461 patch2(scope.lookup(patch.name).asClass, patch)
14581462
Original file line number Diff line number Diff line change @@ -22,6 +22,9 @@ object MiMaFilters {
2222 val StdlibBootstrappedBackwards : Map [String , Seq [ProblemFilter ]] = Map (
2323 Build .stdlibBootstrappedVersion -> {
2424 Seq (
25+ // Methods overwritten in `scala.Predef` instead of `scala.runtime.stdLibPatches`
26+ ProblemFilters .exclude[DirectMissingMethodProblem ](" scala.Predef.assert" ), // `assert` is `inline` and therefore is not emitted in the bytecode
27+
2528 // Files that are not compiled in the bootstrapped library
2629 ProblemFilters .exclude[MissingClassProblem ](" scala.AnyVal" ),
2730
Original file line number Diff line number Diff line change @@ -259,9 +259,9 @@ object Predef extends LowPriorityImplicits {
259259 * @group assertions
260260 */
261261 @ elidable(ASSERTION )
262- def assert (assertion : Boolean ): Unit = {
262+ transparent inline def assert (inline assertion : Boolean ): Unit = {
263263 if (! assertion)
264- throw new java.lang. AssertionError ( " assertion failed " )
264+ scala.runtime. Scala3RunTime .assertFailed( )
265265 }
266266
267267 /** Tests an expression, throwing an `AssertionError` if false.
@@ -274,9 +274,9 @@ object Predef extends LowPriorityImplicits {
274274 * @group assertions
275275 */
276276 @ elidable(ASSERTION ) @ inline
277- final def assert (assertion : Boolean , message : => Any ): Unit = {
277+ transparent inline def assert (inline assertion : Boolean , inline message : => Any ): Unit = {
278278 if (! assertion)
279- throw new java.lang. AssertionError ( " assertion failed: " + message)
279+ scala.runtime. Scala3RunTime .assertFailed( message)
280280 }
281281
282282 /** Tests an expression, throwing an `AssertionError` if false.
You can’t perform that action at this time.
0 commit comments