File tree 3 files changed +14
-7
lines changed
compiler/src/dotty/tools/dotc/core
scala2-library-bootstrapped/src/scala
3 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -1438,11 +1438,14 @@ class Definitions {
1438
1438
)
1439
1439
1440
1440
if patchCls.exists then
1441
+ val patchedInSource = mutable.Set .empty[Symbol ] // example: symbol patched in scala2-library-bootstrapped/src/scala/Predef.scala
1441
1442
val patches = patchCls.info.decls.filter(patch =>
1442
1443
! patch.isConstructor && ! patch.isOneOf(PrivateOrSynthetic ))
1443
1444
for patch <- patches if ! recurse(patch) do
1444
1445
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)
1446
1449
for patch <- patches do
1447
1450
patch.ensureCompleted()
1448
1451
if ! recurse(patch) then
@@ -1453,8 +1456,9 @@ class Definitions {
1453
1456
case _ =>
1454
1457
makeNonClassSymbol(patch)
1455
1458
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)
1458
1462
if patch.isClass then
1459
1463
patch2(scope.lookup(patch.name).asClass, patch)
1460
1464
Original file line number Diff line number Diff line change @@ -9,6 +9,9 @@ object Scala2LibraryBootstrappedMiMaFilters {
9
9
// Files that are not compiled in the bootstrapped library
10
10
ProblemFilters .exclude[MissingClassProblem ](" scala.AnyVal" ),
11
11
12
+ // Overwritten inline methods
13
+ ProblemFilters .exclude[DirectMissingMethodProblem ](" scala.Predef.assert" ),
14
+
12
15
// Scala language features
13
16
ProblemFilters .exclude[DirectMissingMethodProblem ](" scala.language.<clinit>" ),
14
17
ProblemFilters .exclude[DirectMissingMethodProblem ](" scala.language#experimental.<clinit>" ),
Original file line number Diff line number Diff line change @@ -259,9 +259,9 @@ object Predef extends LowPriorityImplicits {
259
259
* @group assertions
260
260
*/
261
261
@ elidable(ASSERTION )
262
- def assert (assertion : Boolean ): Unit = {
262
+ transparent inline def assert (inline assertion : Boolean ): Unit = {
263
263
if (! assertion)
264
- throw new java.lang. AssertionError ( " assertion failed " )
264
+ scala.runtime. Scala3RunTime .assertFailed( )
265
265
}
266
266
267
267
/** Tests an expression, throwing an `AssertionError` if false.
@@ -274,9 +274,9 @@ object Predef extends LowPriorityImplicits {
274
274
* @group assertions
275
275
*/
276
276
@ elidable(ASSERTION ) @ inline
277
- final def assert (assertion : Boolean , message : => Any ): Unit = {
277
+ transparent inline def assert (inline assertion : Boolean , inline message : => Any ): Unit = {
278
278
if (! assertion)
279
- throw new java.lang. AssertionError ( " assertion failed: " + message)
279
+ scala.runtime. Scala3RunTime .assertFailed( message)
280
280
}
281
281
282
282
/** Tests an expression, throwing an `AssertionError` if false.
You can’t perform that action at this time.
0 commit comments