aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/SymDenotations.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/dotty/tools/dotc/core/SymDenotations.scala')
-rw-r--r--src/dotty/tools/dotc/core/SymDenotations.scala9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala
index 30504bc8d..275fb8257 100644
--- a/src/dotty/tools/dotc/core/SymDenotations.scala
+++ b/src/dotty/tools/dotc/core/SymDenotations.scala
@@ -370,6 +370,15 @@ object SymDenotations {
final def isAnonymousModuleVal(implicit ctx: Context) =
this.symbol.is(ModuleVal) && (initial.asSymDenotation.name startsWith nme.ANON_CLASS)
+ /** Is this a companion class method or companion object method?
+ * These methods are generated by Symbols#synthesizeCompanionMethod
+ * and used in SymDenotations#companionClass and
+ * SymDenotations#companionModule .
+ */
+ final def isCompanionMethod(implicit ctx: Context) =
+ name.toTermName == nme.COMPANION_CLASS_METHOD ||
+ name.toTermName == nme.COMPANION_MODULE_METHOD
+
/** Is symbol a primitive value class? */
def isPrimitiveValueClass(implicit ctx: Context) = defn.ScalaValueClasses contains symbol