-
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
Invalid PolyFunction
refinements
#18302
Comments
Example 4def test = polyFun.apply
def polyFun: PolyFunction { def apply: Int } =
new PolyFunction { def apply: Int = 1 }
|
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Aug 25, 2023
`PolyFunction` must be refined with an `apply` method that has a single parameter list with no by-name nor varargs parameters. It may optionally have type parameters. Some of these restrictions could be lifted later, but for now these features are not properly handled by the compiler. Fixes scala#18302
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Aug 25, 2023
`PolyFunction` must be refined with an `apply` method that has a single parameter list with no by-name nor varargs parameters. It may optionally have type parameters. Some of these restrictions could be lifted later, but for now these features are not properly handled by the compiler. Fixes scala#18302
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Aug 25, 2023
`PolyFunction` must be refined with an `apply` method that has a single parameter list with no by-name nor varargs parameters. It may optionally have type parameters. Some of these restrictions could be lifted later, but for now these features are not properly handled by the compiler. Fixes scala#18302
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Aug 25, 2023
`PolyFunction` must be refined with an `apply` method that has a single parameter list with no by-name nor varargs parameters. It may optionally have type parameters. Some of these restrictions could be lifted later, but for now these features are not properly handled by the compiler. Fixes scala#18302
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Sep 7, 2023
`PolyFunction` must be refined with an `apply` method that has a single parameter list with no by-name nor varargs parameters. It may optionally have type parameters. Some of these restrictions could be lifted later, but for now these features are not properly handled by the compiler. Fixes scala#8299 Fixes scala#18302 fixup
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Sep 19, 2023
`PolyFunction` must be refined with an `apply` method that has a single parameter list with no by-name nor varargs parameters. It may optionally have type parameters. Some of these restrictions could be lifted later, but for now these features are not properly handled by the compiler. Fixes scala#8299 Fixes scala#18302 fixup
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Oct 12, 2023
`PolyFunction` must be refined with an `apply` method that has a single parameter list with no by-name nor varargs parameters. It may optionally have type parameters. Some of these restrictions could be lifted later, but for now these features are not properly handled by the compiler. Fixes scala#8299 Fixes scala#18302
nicolasstucki
added a commit
that referenced
this issue
Oct 12, 2023
WojciechMazur
added a commit
that referenced
this issue
Jun 19, 2024
`PolyFunction` must be refined with an `apply` method that has a single parameter list with no by-name nor varargs parameters. It may optionally have type parameters. Some of these restrictions could be lifted later, but for now these features are not properly handled by the compiler. Fixes #8299 Fixes #18302 [Cherry-picked e5ca0c4][modified]
WojciechMazur
added a commit
that referenced
this issue
Jun 20, 2024
`PolyFunction` must be refined with an `apply` method that has a single parameter list with no by-name nor varargs parameters. It may optionally have type parameters. Some of these restrictions could be lifted later, but for now these features are not properly handled by the compiler. Fixes #8299 Fixes #18302 [Cherry-picked e5ca0c4][modified]
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Compiler version
3.4.0-RC1-bin-20230726-97677cc-NIGHTLY
Issue
We are not restricting the signatures of the user-written (in source or macro) refinements of
PolyFunction
. We should restrict and check that those refinements are validExample 1
Works but is outside of the current spec of
PolyFunction
. These should be supported at some point. We should probably emit an error now and allow it once we update the spec.Example 2
This is not supported by the spec and is not intended to be supported. It currently crashes the compiler with
java.util.NoSuchElementException: head of empty list
Example 3
Not in the spec. Crashes the compiler with
java.util.NoSuchElementException: head of empty list
The text was updated successfully, but these errors were encountered: