Skip to content

Commit 0ca0b9e

Browse files
authored
Merge pull request #12117 from dotty-staging/fix-12109
Make annotation reading lazier in Scala2Unpickler
2 parents dede682 + 51f0677 commit 0ca0b9e

File tree

6 files changed

+30
-2
lines changed

6 files changed

+30
-2
lines changed

compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,9 +1011,9 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
10111011
*/
10121012
protected def deferredAnnot(end: Int)(using Context): Annotation = {
10131013
val start = readIndex
1014-
val atp = readTypeRef()
10151014
val phase = ctx.phase
1016-
Annotation.deferred(atp.typeSymbol)(
1015+
Annotation.deferredSymAndTree(
1016+
atReadPos(start, () => atPhase(phase)(readTypeRef().typeSymbol)))(
10171017
atReadPos(start, () => atPhase(phase)(readAnnotationContents(end))))
10181018
}
10191019

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import i12109.*
2+
3+
def test = JsonReaderDefaultValue
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
val scala3Version = sys.props("plugin.scalaVersion")
2+
val scala2Version = "2.13.5"
3+
4+
lazy val lib = project.in(file("lib"))
5+
.settings(
6+
scalaVersion := scala2Version
7+
)
8+
9+
lazy val app = project.in(file("app"))
10+
.dependsOn(lib)
11+
.settings(
12+
scalaVersion := scala3Version
13+
)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package i12109
2+
3+
object JsonReaderDefaultValue extends LowPriorityDefaultValue {
4+
class ReaderDefaultValue extends scala.annotation.StaticAnnotation
5+
}
6+
7+
trait LowPriorityDefaultValue {
8+
@JsonReaderDefaultValue.ReaderDefaultValue
9+
class NoDefaultValue
10+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % sys.props("plugin.version"))
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
> app/compile

0 commit comments

Comments
 (0)