Skip to content

Commit 0150c2a

Browse files
Validate PolyType for @varargs
1 parent 5cf571a commit 0150c2a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

compiler/src/dotty/tools/dotc/transform/ElimRepeated.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,15 @@ class ElimRepeated extends MiniPhase with InfoTransformer { thisPhase =>
147147
/** Is this the type of a method that has a repeated parameter type as
148148
* its last parameter in the last parameter list?
149149
*/
150-
private def isValidJavaVarArgs(t: Type)(using Context): Boolean = t match
150+
private def isValidJavaVarArgs(tp: Type)(using Context): Boolean = tp match
151151
case mt: MethodType =>
152152
val initp :+ lastp = mt.paramInfoss
153153
initp.forall(_.forall(!_.isRepeatedParam)) &&
154154
lastp.nonEmpty &&
155155
lastp.init.forall(!_.isRepeatedParam) &&
156156
lastp.last.isRepeatedParam
157+
case pt: PolyType =>
158+
isValidJavaVarArgs(pt.resultType)
157159
case _ => false
158160

159161

0 commit comments

Comments
 (0)