diff --git a/compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala b/compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala index 018d382cdcaf..d90e7b03e3f9 100644 --- a/compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala +++ b/compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala @@ -1011,9 +1011,9 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas */ protected def deferredAnnot(end: Int)(using Context): Annotation = { val start = readIndex - val atp = readTypeRef() val phase = ctx.phase - Annotation.deferred(atp.typeSymbol)( + Annotation.deferredSymAndTree( + atReadPos(start, () => atPhase(phase)(readTypeRef().typeSymbol)))( atReadPos(start, () => atPhase(phase)(readAnnotationContents(end)))) } diff --git a/sbt-dotty/sbt-test/scala2-compat/i12109/app/App.scala b/sbt-dotty/sbt-test/scala2-compat/i12109/app/App.scala new file mode 100644 index 000000000000..ca92cbd0db02 --- /dev/null +++ b/sbt-dotty/sbt-test/scala2-compat/i12109/app/App.scala @@ -0,0 +1,3 @@ +import i12109.* + +def test = JsonReaderDefaultValue diff --git a/sbt-dotty/sbt-test/scala2-compat/i12109/build.sbt b/sbt-dotty/sbt-test/scala2-compat/i12109/build.sbt new file mode 100644 index 000000000000..4cc8010e1d38 --- /dev/null +++ b/sbt-dotty/sbt-test/scala2-compat/i12109/build.sbt @@ -0,0 +1,13 @@ +val scala3Version = sys.props("plugin.scalaVersion") +val scala2Version = "2.13.5" + +lazy val lib = project.in(file("lib")) + .settings( + scalaVersion := scala2Version + ) + +lazy val app = project.in(file("app")) + .dependsOn(lib) + .settings( + scalaVersion := scala3Version + ) diff --git a/sbt-dotty/sbt-test/scala2-compat/i12109/lib/Lib.scala b/sbt-dotty/sbt-test/scala2-compat/i12109/lib/Lib.scala new file mode 100644 index 000000000000..db42a2d9a92a --- /dev/null +++ b/sbt-dotty/sbt-test/scala2-compat/i12109/lib/Lib.scala @@ -0,0 +1,10 @@ +package i12109 + +object JsonReaderDefaultValue extends LowPriorityDefaultValue { + class ReaderDefaultValue extends scala.annotation.StaticAnnotation +} + +trait LowPriorityDefaultValue { + @JsonReaderDefaultValue.ReaderDefaultValue + class NoDefaultValue +} diff --git a/sbt-dotty/sbt-test/scala2-compat/i12109/project/plugins.sbt b/sbt-dotty/sbt-test/scala2-compat/i12109/project/plugins.sbt new file mode 100644 index 000000000000..c17caab2d98c --- /dev/null +++ b/sbt-dotty/sbt-test/scala2-compat/i12109/project/plugins.sbt @@ -0,0 +1 @@ +addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % sys.props("plugin.version")) diff --git a/sbt-dotty/sbt-test/scala2-compat/i12109/test b/sbt-dotty/sbt-test/scala2-compat/i12109/test new file mode 100644 index 000000000000..19aca297fdcf --- /dev/null +++ b/sbt-dotty/sbt-test/scala2-compat/i12109/test @@ -0,0 +1 @@ +> app/compile