File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
compiler/src/dotty/tools/dotc/printing Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -268,7 +268,20 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
268
268
val selfName = if (self.name == nme.WILDCARD ) " this" else self.name.toString
269
269
(selfName ~ optText(self.tpt)(" : " ~ _) ~ " =>" ).close
270
270
} provided ! self.isEmpty
271
- val bodyText = " {" ~~ selfText ~~ toTextGlobal(primaryConstrs ::: impl.body, " \n " ) ~ " }"
271
+
272
+ val body = if (ctx.settings.YtestPickler .value) {
273
+ // Pickling/unpickling reorders the body members, so we need to homogenize
274
+ val (params, rest) = impl.body partition {
275
+ case stat : TypeDef => stat.symbol.is(Param )
276
+ case stat : ValOrDefDef =>
277
+ stat.symbol.is(ParamAccessor ) && ! stat.symbol.isSetter
278
+ case _ => false
279
+ }
280
+ params ::: rest
281
+ } else impl.body
282
+
283
+ val bodyText = " {" ~~ selfText ~~ toTextGlobal(primaryConstrs ::: body, " \n " ) ~ " }"
284
+
272
285
prefix ~ (" extends" provided ! ofNew) ~~ parentsText ~~ bodyText
273
286
}
274
287
You can’t perform that action at this time.
0 commit comments