@@ -256,7 +256,6 @@ class Definitions {
256256 */
257257 @ tu lazy val ScalaShadowingPackage : TermSymbol = requiredPackage(nme.scalaShadowing)
258258
259-
260259 /** Note: We cannot have same named methods defined in Object and Any (and AnyVal, for that matter)
261260 * because after erasure the Any and AnyVal references get remapped to the Object methods
262261 * which would result in a double binding assertion failure.
@@ -1133,19 +1132,28 @@ class Definitions {
11331132 */
11341133 def patchStdLibClass (denot : ClassDenotation )(using Context ): Unit =
11351134
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 =
11381139 val scope = denot.info.decls.openForMutations
11391140 if patchCls.exists then
11401141 val patches = patchCls.info.decls.filter(patch =>
11411142 ! patch.isConstructor && ! patch.isOneOf(PrivateOrSynthetic ))
1142- for patch <- patches do
1143+ for patch <- patches if ! recurse(patch) do
11431144 val e = scope.lookupEntry(patch.name)
11441145 if e != null then scope.unlink(e)
11451146 for patch <- patches do
11461147 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)
11491157
11501158 if denot.name == tpnme.Predef .moduleClassName && denot.symbol == ScalaPredefModuleClass then
11511159 patchWith(ScalaPredefModuleClassPatch )
0 commit comments