diff --git a/compiler/src/dotty/tools/dotc/core/SymDenotations.scala b/compiler/src/dotty/tools/dotc/core/SymDenotations.scala index 50b940ec9211..68131320e302 100644 --- a/compiler/src/dotty/tools/dotc/core/SymDenotations.scala +++ b/compiler/src/dotty/tools/dotc/core/SymDenotations.scala @@ -522,7 +522,9 @@ object SymDenotations { case Some(ann) => ann.arguments match { case Literal(Constant(str: String)) :: Nil => - if (isType) str.toTypeName else str.toTermName + if isTerm then str.toTermName + else if is(Module) then str.toTypeName.moduleClassName + else str.toTypeName case _ => name } case _ => name diff --git a/tests/run/i7723.scala b/tests/run/i7723.scala new file mode 100644 index 000000000000..53303b029597 --- /dev/null +++ b/tests/run/i7723.scala @@ -0,0 +1,9 @@ +object Test with + @scala.annotation.alpha("A") + class B(val i: Int = 1) + + def main(args: Array[String]): Unit = + assert(B().i == 1) + +@scala.annotation.alpha("AA") + class BB(val i: Int = 1)