aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Types.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-08-03 17:06:29 +0200
committerMartin Odersky <odersky@gmail.com>2014-08-03 17:06:29 +0200
commitb88b958bb7f25ba45a6c15c9f554df2d4c6746ed (patch)
tree59606a00437c471699f596eb12b2c74c3826b1a5 /src/dotty/tools/dotc/core/Types.scala
parent29e8f67ba19ab531932c98eba1411a63815cfa80 (diff)
downloaddotty-b88b958bb7f25ba45a6c15c9f554df2d4c6746ed.tar.gz
dotty-b88b958bb7f25ba45a6c15c9f554df2d4c6746ed.tar.bz2
dotty-b88b958bb7f25ba45a6c15c9f554df2d4c6746ed.zip
Add varargs bridge methods
Distinguish translations between Java and Scala varargs methods and add bridges where needed.
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