File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
compiler/src/dotty/tools/dotc/core/tasty Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -1090,7 +1090,19 @@ class TreeUnpickler(reader: TastyReader,
1090
1090
if (ctx.mode.is(Mode .ReadPositions )) {
1091
1091
posUnpicklerOpt match {
1092
1092
case Some (posUnpickler) =>
1093
- posUnpickler.posAt(addr)
1093
+ val addrPos = posUnpickler.posAt(addr)
1094
+ if (addrPos == NoPosition && bytes(index(addr)) == SHARED ) {
1095
+ // Note: A tree can only be represented by a SHARED node if it's
1096
+ // identical to some other tree, so you might wonder why we even
1097
+ // bother checking addrPos for such nodes. It's because TypeTrees
1098
+ // can be pickled as just a type and still have their own position,
1099
+ // even if the type is just a SHARED node.
1100
+
1101
+ val sharedFork = forkAt(addr)
1102
+ sharedFork.reader.readByte()
1103
+ posAt(sharedFork.reader.readAddr())
1104
+ }
1105
+ else addrPos
1094
1106
case _ =>
1095
1107
NoPosition
1096
1108
}
You can’t perform that action at this time.
0 commit comments