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 @@ -1435,11 +1435,14 @@ class Definitions {
14351435 )
14361436
14371437 if patchCls.exists then
1438+ val patchedInSource = mutable.Set .empty[Symbol ] // example: symbol patched in scala2-library-bootstrapped/src/scala/Predef.scala
14381439 val patches = patchCls.info.decls.filter(patch =>
14391440 ! patch.isConstructor && ! patch.isOneOf(PrivateOrSynthetic ))
14401441 for patch <- patches if ! recurse(patch) do
14411442 val e = scope.lookupEntry(patch.name)
1442- if e != null then scope.unlink(e)
1443+ if e != null then
1444+ if e.sym.isInlineMethod then patchedInSource += patch
1445+ else scope.unlink(e)
14431446 for patch <- patches do
14441447 patch.ensureCompleted()
14451448 if ! recurse(patch) then
@@ -1450,8 +1453,9 @@ class Definitions {
14501453 case _ =>
14511454 makeNonClassSymbol(patch)
14521455 end match
1453- sym.annotations = patch.annotations
1454- scope.enter(sym)
1456+ if ! patchedInSource(sym) then
1457+ sym.annotations = patch.annotations
1458+ scope.enter(sym)
14551459 if patch.isClass then
14561460 patch2(scope.lookup(patch.name).asClass, patch)
14571461
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