Closed
Description
Minimized code
Say you define a simple function that takes an inline closure:
object FunObject {
def fun(t: String => String) = t
}
If you try to match the function call and the body of the closure like this:
case '{ FunObject.fun(($arg: String) => $out) } =>
This will never match.
Additionally, if you try to use the $arg
parameter e.g. println(arg.show)
the following error will happen.
[error] 15 | println(arg.show)
[error] | ^^^
[error] | Not found: arg
Expectation
The closure should match and you should be able to extract the $arg
and $out parameters
.
Using quasi-quotes, I am able to do this:
case q"FunObject.fun(($arg) => $out)" =>
process(arg.name.decodedName, out)
I depend on this pattern heavily in the Quill Parser. I think quoted-matching should have the same capability.
Code Sample
Code sample with complete reproduction can be found here:
https://github.com/deusaquilus/closure_bug