Closed
Description
Minimized code
Let's say I have a trait with a method extended by a companion:
object Companion extends Trait
trait Trait {
def fun(first: String): String = "anything"
}
Then I try to match this code in a macro:
tree.unseal.underlyingArgument.seal match {
case vv @ '{ ($s: Trait).fun($arg) } => arg
}
When invoking the macro with the Companion
as an import:
import Companion._
mac(fun("blah"))
The following compiler error occurs:
Exception occurred while executing macro expansion.
java.lang.ClassCastException: scala.Tuple1 cannot be cast to scala.Tuple2
at companionbug.Macro$.macImpl(Macro.scala:16)
Expectation
The code should compile and the match should work.
Code Sample
Full code sample can be found here:
https://github.com/deusaquilus/companion_bug