Closed
Description
We want to be able to support the following kind of use case
object MyPattern {
inline def unapply(x: T): Option[U] = Some(x)
}
x match
case MyPattern(y) => ....
where the call to MyPattern.unapply
will get inline and possibly be a macro.
Technically, this would mean generating a new instance with a compatible definition of the unapply and then inline the code in it's body. The return type would be inferred from the expansion of the unapply (whiteboxity). The anonymous class could be optimized away when the pattern matching compiled to labeled blocks.
x match
case <new { def unapply(x: T) = MyPattern.unnaply(x) }>(y) => ....