Skip to content

Commit 27032b5

Browse files
committed
Fix IDE crash on @afterclass
The TreeAccumulater was stuck in an infinite loop over the synthetic constructor of java annotations. This could be reproduced by opening the CompilationTests.scala in the IDE.
1 parent f89e618 commit 27032b5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

compiler/src/dotty/tools/dotc/ast/Trees.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1231,7 +1231,10 @@ object Trees {
12311231
case Ident(name) =>
12321232
x
12331233
case Select(qualifier, name) =>
1234-
this(x, qualifier)
1234+
val isJavaAnnotationConstructor =
1235+
name == nme.CONSTRUCTOR && tree.symbol.is(JavaDefined | Synthetic, butNot = Method)
1236+
if (isJavaAnnotationConstructor) x
1237+
else this(x, qualifier)
12351238
case This(qual) =>
12361239
x
12371240
case Super(qual, mix) =>

0 commit comments

Comments
 (0)