Skip to content

Commit 550f697

Browse files
committed
Fix #1544: extend maximum name length to 2^14 bytes
1 parent 9177303 commit 550f697

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/dotty/tools/dotc/core/tasty/NameBuffer.scala

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,13 @@ class NameBuffer extends TastyBuffer(10000) {
4242

4343
private def withLength(op: => Unit): Unit = {
4444
val lengthAddr = currentAddr
45-
writeByte(0)
45+
val lengthFieldLength = 2
46+
for (i <- 0 until lengthFieldLength)
47+
writeByte(0)
4648
op
47-
val length = currentAddr.index - lengthAddr.index - 1
48-
assert(length < 128)
49-
putNat(lengthAddr, length, 1)
49+
val length = currentAddr.index - lengthAddr.index - lengthFieldLength
50+
assert(length < (1 << (7 * lengthFieldLength)))
51+
putNat(lengthAddr, length, lengthFieldLength)
5052
}
5153

5254
def writeNameRef(ref: NameRef) = writeNat(ref.index)

0 commit comments

Comments
 (0)