Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions compiler/src/dotty/tools/dotc/transform/ElimRepeated.scala
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,8 @@ class ElimRepeated extends MiniPhase with InfoTransformer { thisPhase =>
throw new Exception("Match error in @varargs checks. This should not happen, please open an issue " + tp)

/** Add the symbol of a Java varargs forwarder to the scope.
* It retains all the flags of the original method.
* It retains the flags of the original method except `Deferred`,
* since the forwarder's body is synthesized in `transformDefDef`.
*
* @param original the original method symbol
* @param isBridge true if we are generating a "bridge" (synthetic override forwarder)
Expand All @@ -241,7 +242,7 @@ class ElimRepeated extends MiniPhase with InfoTransformer { thisPhase =>

// For simplicity we always set the varargs flag,
// although it's not strictly necessary for overrides.
val flags = original.flags | JavaVarargs
val flags = (original.flags &~ Deferred) | JavaVarargs

// The java-compatible forwarder symbol
val forwarder =
Expand Down
5 changes: 5 additions & 0 deletions tests/pos/i25600.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
trait T:
@annotation.varargs
def t(s: String, a: Any*): String

val x: T = (s, a) => s
Loading