Skip to content

Commit 0ac2bcf

Browse files
committed
Fix how unpickler reads an erased function type
1 parent 9b98936 commit 0ac2bcf

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ class TreeUnpickler(reader: TastyReader,
320320
}
321321

322322
def readLengthType(): Type = {
323-
val end = readEnd()
323+
var end = readEnd()
324324

325325
def readMethodic[N <: Name, PInfo <: Type, LT <: LambdaType]
326326
(companionOp: FlagSet => LambdaTypeCompanion[N, PInfo, LT], nameMap: Name => N): LT = {
@@ -400,11 +400,11 @@ class TreeUnpickler(reader: TastyReader,
400400
case POLYtype =>
401401
readMethodic(_ => PolyType, _.toTypeName)
402402
case ERASEDMETHODtype =>
403-
val isErased =
404-
val end = readEnd()
405-
collectWhile(end != currentAddr) {
406-
readByte() == 1
407-
}
403+
// The first `end` was the length of the erased parameter list, read and fix it.
404+
val isErased = collectWhile(end != currentAddr) {
405+
readByte() == 1
406+
}
407+
end = readEnd()
408408
def methodTypeCompanion(mods: FlagSet): MethodTypeCompanion =
409409
if mods.is(Implicit) then ErasedImplicitMethodType(isErased)
410410
else if mods.is(Given) then ErasedContextualMethodType(isErased)

0 commit comments

Comments
 (0)