@@ -183,18 +183,7 @@ class ElimRepeated extends MiniPhase with InfoTransformer { thisPhase =>
183
183
// non-overrides cannot be synthetic otherwise javac refuses to call them
184
184
flags = if javaOverride then flags | Artifact else flags,
185
185
info = toJavaVarArgs(ddef.symbol.info)
186
- ).enteredAfter(thisPhase).asTerm
187
-
188
- val bridgeDef = polyDefDef(bridge, trefs => vrefss => {
189
- val init :+ (last :+ vararg) = vrefss
190
- // Can't call `.argTypes` here because the underlying array type is of the
191
- // form `Array[? <: SomeType]`, so we need `.argInfos` to get the `TypeBounds`.
192
- val elemtp = vararg.tpe.widen.argInfos.head
193
- ref(original.termRef)
194
- .appliedToTypes(trefs)
195
- .appliedToArgss(init)
196
- .appliedToArgs(last :+ tpd.wrapArray(vararg, elemtp))
197
- })
186
+ ).asTerm
198
187
199
188
val bridgeDenot = bridge.denot
200
189
currentClass.info.member(bridge.name).alternatives.find { s =>
@@ -205,7 +194,19 @@ class ElimRepeated extends MiniPhase with InfoTransformer { thisPhase =>
205
194
ctx.error(s " @varargs produces a forwarder method that conflicts with ${conflict.showDcl}" , ddef.sourcePos)
206
195
EmptyTree
207
196
case None =>
208
- Thicket (ddef, bridgeDef)
197
+ ctx.atNextPhase {
198
+ val bridgeDef = polyDefDef(bridge, trefs => vrefss => {
199
+ val init :+ (last :+ vararg) = vrefss
200
+ // Can't call `.argTypes` here because the underlying array type is of the
201
+ // form `Array[? <: SomeType]`, so we need `.argInfos` to get the `TypeBounds`.
202
+ val elemtp = vararg.tpe.widen.argInfos.head
203
+ ref(original.termRef)
204
+ .appliedToTypes(trefs)
205
+ .appliedToArgss(init)
206
+ .appliedToArgs(last :+ tpd.wrapArray(vararg, elemtp))
207
+ })
208
+ Thicket (ddef, bridgeDef)
209
+ }
209
210
210
211
/** Convert type from Scala to Java varargs method */
211
212
private def toJavaVarArgs (tp : Type )(using Context ): Type = tp match
0 commit comments