File tree 1 file changed +11
-1
lines changed
compiler/src/dotty/tools/dotc/transform 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import StdNames._
12
12
import NameKinds ._
13
13
import Flags ._
14
14
import Annotations ._
15
+ import ValueClasses .isDerivedValueClass
15
16
16
17
import language .implicitConversions
17
18
import scala .annotation .tailrec
@@ -59,10 +60,19 @@ class SymUtils(val self: Symbol) extends AnyVal {
59
60
60
61
def isSuperAccessor (implicit ctx : Context ): Boolean = self.name.is(SuperAccessorName )
61
62
62
- /** A type or term parameter or a term parameter accessor */
63
+ /** Is this a type or term parameter or a term parameter accessor? */
63
64
def isParamOrAccessor (implicit ctx : Context ): Boolean =
64
65
self.is(Param ) || self.is(ParamAccessor )
65
66
67
+ /** Is this a case class for which a product mirror is generated?
68
+ * Excluded are value classes, abstract classes and case classes with more than one
69
+ * parameter section.
70
+ */
71
+ def isGenericProduct (implicit ctx : Context ): Boolean =
72
+ self.is(CaseClass , butNot = Abstract ) &&
73
+ self.primaryConstructor.info.paramInfoss.length == 1 &&
74
+ ! isDerivedValueClass(self)
75
+
66
76
/** If this is a constructor, its owner: otherwise this. */
67
77
final def skipConstructor (implicit ctx : Context ): Symbol =
68
78
if (self.isConstructor) self.owner else self
You can’t perform that action at this time.
0 commit comments