aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Types.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/dotty/tools/dotc/core/Types.scala')
-rw-r--r--src/dotty/tools/dotc/core/Types.scala9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala
index a37b872d2..84c799129 100644
--- a/src/dotty/tools/dotc/core/Types.scala
+++ b/src/dotty/tools/dotc/core/Types.scala
@@ -158,6 +158,15 @@ object Types {
def isRepeatedParam(implicit ctx: Context): Boolean =
typeSymbol eq defn.RepeatedParamClass
+ /** Is this the type of a method that has a repeated parameter type as
+ * last parameter type?
+ */
+ def isVarArgsMethod(implicit ctx: Context): Boolean = this match {
+ case tp: PolyType => tp.resultType.isVarArgsMethod
+ case MethodType(_, paramTypes) => paramTypes.nonEmpty && paramTypes.last.isRepeatedParam
+ case _ => false
+ }
+
/** Is this an alias TypeBounds? */
def isAlias: Boolean = this match {
case TypeBounds(lo, hi) => lo eq hi