Skip to content

Commit f18245d

Browse files
committed
Make annotation names compilation-order independent
1 parent 8dd9be5 commit f18245d

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -811,14 +811,16 @@ object desugar {
811811
case New(tpt) => clsName(tpt)
812812
case AppliedTypeTree(tycon, _) => clsName(tycon)
813813
case tree: RefTree if tree.name.isTypeName => tree.name.toString
814+
case Parens(tree) => clsName(tree)
815+
case tree: TypeDef => tree.name.toString
814816
case _ => ""
815817
}
816818
val fromName = clsName(augmented)
817819
val toName = impl.parents match {
818-
case parent :: _ if !clsName(parent).isEmpty => clsName(parent)
820+
case parent :: _ if !clsName(parent).isEmpty => "To" + clsName(parent)
819821
case _ => str.Augmentation
820822
}
821-
fromName ++ toName
823+
s"${fromName}${toName}_in_${ctx.owner.topLevelClass.flatName}"
822824
}
823825
val icls =
824826
TypeDef(UniqueName.fresh(decoName.toTermName).toTypeName,

tests/pos/augment.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ object augments {
6363
def === (that: T): Boolean = implicitly[Eql[T]].eql(this, that)
6464
}
6565

66-
augment Rectangle[type T: Eql] {
66+
augment Rectangle[type T: Eql] extends HasEql[Rectangle[T]] {
6767
def === (that: Rectangle[T]) =
6868
this.x === that.x &&
6969
this.y === that.y &&

0 commit comments

Comments
 (0)