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
A and (=> A) do not unify when used as function type parameters #7431
Comments
Imported From: https://issues.scala-lang.org/browse/SI-7431?orig=1 |
@paulp said: But you can make one. scala> implicit def upgradeByName[A, B](x: (=> A) => B): A => B = (p: A) => x(p)
upgradeByName: [A, B](x: (=> A) => B)A => B
scala> apply("hello")(log)
hello The other way is buggy as is clear from the CCE. |
Dan Rosen (mergeconflict) said: 6.26.2: A parameterless method This is talking about the semantics of expression evaluation, though, not the typing rules... |
@paulp said: |
Maybe this hasn't been fixed yet because it both should and should not compile. I hear Kentucky Mule can do both in parallel. |
The situation doesn't seem to have changed in Scala 3. Even the |
or
|
It doesn't seem possible to use
(=> A) => B
in contexts requiringA => B
:If you try to go the other direction, using
A => B
in contexts requiring(=> A) => B
, the result depends on how you're trying to do it:The text was updated successfully, but these errors were encountered: