Skip to content

Make partial function literals serializable #4444

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

Merged
merged 1 commit into from
May 3, 2018

Conversation

allanrenucci
Copy link
Contributor

No description provided.

@allanrenucci
Copy link
Contributor Author

A more complex (and currently failing) test case can be found in #4446

@allanrenucci allanrenucci changed the title Fix serialisation of partial function literals Make partial function literals serializable May 3, 2018
@allanrenucci allanrenucci requested a review from smarter May 3, 2018 09:03
@@ -111,8 +111,8 @@ class ExpandSAMs extends MiniPhase {
val isDefinedAtDef = transformFollowingDeep(DefDef(isDefinedAtFn, isDefinedAtRhs(_)))
val applyOrElseDef = transformFollowingDeep(DefDef(applyOrElseFn, applyOrElseRhs(_)))

val parent = defn.AbstractPartialFunctionType.appliedTo(tpe.argInfos)
val anonCls = AnonClass(parent :: Nil, List(isDefinedAtFn, applyOrElseFn), List(nme.isDefinedAt, nme.applyOrElse))
val parents = List(defn.AbstractPartialFunctionType.appliedTo(tpe.argInfos), defn.SerializableType)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer JavaSerializableType over SerializableType (the latter should die in a fire but that hasn't happened yet: scala/bug#9080)

Copy link
Contributor Author

@allanrenucci allanrenucci May 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK I'll change. I used scala serializable because that's what scalac uses

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, maybe we should keep SerializableType for now and eventually replace them all at once.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your call!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep it as is for now

@allanrenucci allanrenucci merged commit 48a2f4b into scala:master May 3, 2018
@allanrenucci allanrenucci deleted the serialize-pf branch May 3, 2018 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants