@@ -256,7 +256,6 @@ class Definitions {
256
256
*/
257
257
@ tu lazy val ScalaShadowingPackage : TermSymbol = requiredPackage(nme.scalaShadowing)
258
258
259
-
260
259
/** Note: We cannot have same named methods defined in Object and Any (and AnyVal, for that matter)
261
260
* because after erasure the Any and AnyVal references get remapped to the Object methods
262
261
* which would result in a double binding assertion failure.
@@ -1133,19 +1132,28 @@ class Definitions {
1133
1132
*/
1134
1133
def patchStdLibClass (denot : ClassDenotation )(using Context ): Unit =
1135
1134
1136
- def patchWith (patchCls : Symbol ) =
1137
- denot.sourceModule.info = denot.typeRef // we run into a cyclic reference when patching if this line is omitted
1135
+ def recurse (patch : Symbol ) =
1136
+ patch.name.toString.startsWith(" experimental" )
1137
+
1138
+ def patch2 (denot : ClassDenotation , patchCls : Symbol ): Unit =
1138
1139
val scope = denot.info.decls.openForMutations
1139
1140
if patchCls.exists then
1140
1141
val patches = patchCls.info.decls.filter(patch =>
1141
1142
! patch.isConstructor && ! patch.isOneOf(PrivateOrSynthetic ))
1142
- for patch <- patches do
1143
+ for patch <- patches if ! recurse(patch) do
1143
1144
val e = scope.lookupEntry(patch.name)
1144
1145
if e != null then scope.unlink(e)
1145
1146
for patch <- patches do
1146
1147
patch.ensureCompleted()
1147
- patch.denot = patch.denot.copySymDenotation(owner = denot.symbol)
1148
- scope.enter(patch)
1148
+ if ! recurse(patch) then
1149
+ patch.denot = patch.denot.copySymDenotation(owner = denot.symbol)
1150
+ scope.enter(patch)
1151
+ else if patch.isClass then
1152
+ patch2(scope.lookup(patch.name).asClass, patch)
1153
+
1154
+ def patchWith (patchCls : Symbol ) =
1155
+ denot.sourceModule.info = denot.typeRef // we run into a cyclic reference when patching if this line is omitted
1156
+ patch2(denot, patchCls)
1149
1157
1150
1158
if denot.name == tpnme.Predef .moduleClassName && denot.symbol == ScalaPredefModuleClass then
1151
1159
patchWith(ScalaPredefModuleClassPatch )
0 commit comments