Skip to content

Commit cccbc4d

Browse files
committed
Don't lift arguments out of Java annotation constructors
Lifting such arguments breaks the contract with the backend, which expects to see default getters inline, not lifted out.
1 parent f6be536 commit cccbc4d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

compiler/src/dotty/tools/dotc/typer/Applications.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,8 +571,11 @@ trait Applications extends Compatibility { self: Typer with Dynamic =>
571571

572572
def normalizedFun = myNormalizedFun
573573

574+
private def isJavaAnnotConstr(sym: Symbol) =
575+
sym.is(JavaDefined) && sym.isConstructor && sym.owner.derivesFrom(defn.AnnotationClass)
576+
574577
override def liftFun(): Unit =
575-
if (liftedDefs == null) {
578+
if (liftedDefs == null && !isJavaAnnotConstr(methRef.symbol)) {
576579
liftedDefs = new mutable.ListBuffer[Tree]
577580
myNormalizedFun = liftApp(liftedDefs, myNormalizedFun)
578581
}

0 commit comments

Comments
 (0)