-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix #2166: unpickling of shared CaseDef #2187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Missing test case? |
The pickling tests pass, but the bootstrap pickling failed. Need to investigate further. |
@@ -1062,7 +1062,13 @@ class TreeUnpickler(reader: TastyReader, tastyName: TastyName.Table, posUnpickle | |||
} | |||
|
|||
def readCases(end: Addr)(implicit ctx: Context): List[CaseDef] = | |||
collectWhile(nextByte == CASEDEF && currentAddr != end) { readCase()(ctx.fresh.setNewScope) } | |||
collectWhile(nextByte == CASEDEF | nextByte == SHARED && currentAddr != end) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you want ||
, not |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And you also need to put parens in the correct place because &&
has higher precedence:
(nextByte == CASEDEF || nextByte == SHARED) && currentAddr != end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot @smarter , I owe you a beer 👍 I will no longer claim I can write Scala in my CV :)
@@ -1062,7 +1062,13 @@ class TreeUnpickler(reader: TastyReader, tastyName: TastyName.Table, posUnpickle | |||
} | |||
|
|||
def readCases(end: Addr)(implicit ctx: Context): List[CaseDef] = | |||
collectWhile(nextByte == CASEDEF && currentAddr != end) { readCase()(ctx.fresh.setNewScope) } | |||
collectWhile((nextByte == CASEDEF || nextByte == SHARED) && currentAddr != end) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can simply use nextUnsharedTag
for this.
collectWhile(nextUnsharedTag == CASEDEF && currentAddr != end) { readCase()(ctx.fresh.setNewScope) }
Sorry, that was a wrong comment. In fact your original version is the correct one. |
Fix #2166: the unpickling of CaseDef should take care of SHARED trees.