-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Disallow use of PolyFunction in user code #18920
Conversation
PolyFunction
trait in class parents2dddaf2
to
4ed7893
Compare
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 this might be too drastic, PolyFunction
could come up in type inference for example (val x = if cond then polyFun1 else polyFun2
), and if a type can be inferred it should be expressible whenever possible. An alternative I would favor would be to mark PolyFunction
as @deprecatedInheritance
.
(I'm assuming we can tweak |
We do not seem to be checking for |
We could use the first commit (1b4b390) instead. This one only checks the parents of classes and does not restrict anything on types. |
Using just the first commit sounds good to me. |
Users should only write lambdas. Fixes scala#10075
4ed7893
to
63b31ac
Compare
Removed the second commit and rebased |
The
PolyFunction
trait should only be used for compiler generatedencoded lambdas.
Any other use case that was allowed before was accidental. In the future,
we might consider supporting these if there is a good use case. This would
probably require a SIP.
Fixes #10075