File tree Expand file tree Collapse file tree 2 files changed +11
-7
lines changed
compiler/src/dotty/tools/dotc/core
scala2-library-bootstrapped/src/scala Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -1438,11 +1438,14 @@ class Definitions {
14381438 )
14391439
14401440 if patchCls.exists then
1441+ val patchedInSource = mutable.Set .empty[Symbol ] // example: symbol patched in scala2-library-bootstrapped/src/scala/Predef.scala
14411442 val patches = patchCls.info.decls.filter(patch =>
14421443 ! patch.isConstructor && ! patch.isOneOf(PrivateOrSynthetic ))
14431444 for patch <- patches if ! recurse(patch) do
14441445 val e = scope.lookupEntry(patch.name)
1445- if e != null then scope.unlink(e)
1446+ if e != null then
1447+ if e.sym.isInlineMethod then patchedInSource += patch
1448+ else scope.unlink(e)
14461449 for patch <- patches do
14471450 patch.ensureCompleted()
14481451 if ! recurse(patch) then
@@ -1453,8 +1456,9 @@ class Definitions {
14531456 case _ =>
14541457 makeNonClassSymbol(patch)
14551458 end match
1456- sym.annotations = patch.annotations
1457- scope.enter(sym)
1459+ if ! patchedInSource(sym) then
1460+ sym.annotations = patch.annotations
1461+ scope.enter(sym)
14581462 if patch.isClass then
14591463 patch2(scope.lookup(patch.name).asClass, patch)
14601464
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