File tree 1 file changed +4
-5
lines changed
compiler/src/dotty/tools/dotc/transform
1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -29,21 +29,20 @@ class RepeatableAnnotations extends MiniPhase:
29
29
annsByType.flatMap {
30
30
case (_, a :: Nil ) => a :: Nil
31
31
case (sym, anns) if sym.derivesFrom(defn.ClassfileAnnotationClass ) =>
32
- sym.annotations.find(_ matches defn.JavaRepeatableAnnot ).flatMap(_.argumentConstant(0 )) match
32
+ sym.getAnnotation( defn.JavaRepeatableAnnot ).flatMap(_.argumentConstant(0 )) match
33
33
case Some (Constant (containerTpe : Type )) =>
34
34
val clashingAnns = annsByType.getOrElse(containerTpe.classSymbol, Nil )
35
- if ! clashingAnns.isEmpty then
35
+ if clashingAnns.nonEmpty then
36
36
// this is the same error javac would raise in this case
37
- val pos = clashingAnns.map(_ .tree.srcPos).minBy(_.line)
37
+ val pos = clashingAnns.head .tree.srcPos
38
38
report.error(" Container must not be present at the same time as the element it contains" , pos)
39
39
Nil
40
40
else
41
41
val aggregated = JavaSeqLiteral (anns.map(_.tree).toList, TypeTree (sym.typeRef))
42
42
Annotation (containerTpe, NamedArg (" value" .toTermName, aggregated)) :: Nil
43
43
case _ =>
44
- val pos = anns.map(_ .tree.srcPos).sortBy(_.line).apply( 1 )
44
+ val pos = anns.head .tree.srcPos
45
45
report.error(" Not repeatable annotation repeated" , pos)
46
46
Nil
47
47
case (_, anns) => anns
48
48
}.toList
49
-
You can’t perform that action at this time.
0 commit comments