File tree 2 files changed +14
-1
lines changed
compiler/src/dotty/tools/dotc/transform
2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -610,7 +610,16 @@ class SyntheticMembers(thisPhase: DenotTransformer) {
610
610
611
611
def addSyntheticMembers (impl : Template )(using Context ): Template = {
612
612
val clazz = ctx.owner.asClass
613
+ val syntheticMembers = serializableObjectMethod(clazz) ::: serializableEnumValueMethod(clazz) ::: caseAndValueMethods(clazz)
614
+ checkInlining(syntheticMembers)
613
615
addMirrorSupport(
614
- cpy.Template (impl)(body = serializableObjectMethod(clazz) ::: serializableEnumValueMethod(clazz) ::: caseAndValueMethods(clazz) ::: impl.body))
616
+ cpy.Template (impl)(body = syntheticMembers ::: impl.body))
615
617
}
618
+
619
+ private def checkInlining (syntheticMembers : List [Tree ])(using Context ): Unit =
620
+ if syntheticMembers.exists(_.existsSubTree {
621
+ case tree : GenericApply => tree.symbol.isAllOf(InlineMethod )
622
+ case tree : Select => tree.symbol.isAllOf(InlineMethod )
623
+ case _ => false
624
+ }) then ctx.compilationUnit.needsInlining = true
616
625
}
Original file line number Diff line number Diff line change
1
+ class Foo (val id : Int ) {
2
+ inline def == (that : Foo ): Boolean = true
3
+ }
4
+ case class FooWrapper (foo : Foo )
You can’t perform that action at this time.
0 commit comments