Skip to content

Commit 455c8f3

Browse files
Use CtxLazy for varargs annotation
1 parent c86c2be commit 455c8f3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import Denotations._, SymDenotations._
1515
import dotty.tools.dotc.ast.tpd
1616
import TypeErasure.erasure
1717
import DenotTransformers._
18-
import dotty.tools.backend.jvm.DottyBackendInterface.requiredClass
1918

2019
object ElimRepeated {
2120
val name: String = "elimRepeated"
@@ -27,6 +26,9 @@ object ElimRepeated {
2726
class ElimRepeated extends MiniPhase with InfoTransformer { thisPhase =>
2827
import ast.tpd._
2928

29+
private val varargsAnnot = new CtxLazy(
30+
summon[Context].requiredClass("scala.annotation.varargs"))
31+
3032
override def phaseName: String = ElimRepeated.name
3133

3234
override def changesMembers: Boolean = true // the phase adds vararg bridges
@@ -48,7 +50,7 @@ class ElimRepeated extends MiniPhase with InfoTransformer { thisPhase =>
4850

4951
private def overridesJava(sym: Symbol)(implicit ctx: Context) = sym.allOverriddenSymbols.exists(_.is(JavaDefined))
5052

51-
private def hasVargsAnnotation(sym: Symbol)(using ctx: Context) = sym.hasAnnotation(requiredClass[scala.annotation.varargs])
53+
private def hasVargsAnnotation(sym: Symbol)(using ctx: Context) = sym.hasAnnotation(varargsAnnot())
5254

5355
private def elimRepeated(tp: Type)(implicit ctx: Context): Type = tp.stripTypeVar match {
5456
case tp @ MethodTpe(paramNames, paramTypes, resultType) =>

0 commit comments

Comments
 (0)