File tree 1 file changed +4
-3
lines changed
compiler/src/dotty/tools/dotc/core
1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -1127,16 +1127,17 @@ class Definitions {
1127
1127
* any definitions of `denot` that have the same name as one of the copied
1128
1128
* definitions.
1129
1129
*
1130
+ * If an object is present in both the original class and the patch class,
1131
+ * it is not overwritten. Instead its members are copied recursively.
1132
+ *
1130
1133
* To avpid running into cycles on bootstrap, patching happens only if `patchCls`
1131
1134
* is read from a classfile.
1132
1135
*/
1133
1136
def patchStdLibClass (denot : ClassDenotation )(using Context ): Unit =
1134
1137
1135
- def recurse (patch : Symbol ) =
1136
- patch.name.toString.startsWith(" experimental" )
1137
-
1138
1138
def patch2 (denot : ClassDenotation , patchCls : Symbol ): Unit =
1139
1139
val scope = denot.info.decls.openForMutations
1140
+ def recurse (patch : Symbol ) = patch.is(Module ) && scope.lookup(patch.name).exists
1140
1141
if patchCls.exists then
1141
1142
val patches = patchCls.info.decls.filter(patch =>
1142
1143
! patch.isConstructor && ! patch.isOneOf(PrivateOrSynthetic ))
You can’t perform that action at this time.
0 commit comments