Skip to content

Instantly share code, notes, and snippets.

@pomadchin
Created November 19, 2015 10:31
Show Gist options
  • Save pomadchin/d4fedf578729c2cb3aff to your computer and use it in GitHub Desktop.
Save pomadchin/d4fedf578729c2cb3aff to your computer and use it in GitHub Desktop.
Example of the correct values call.
import annotations.template
import reflect.runtime.universe.TypeTag
case class SW(s: String)
case class IW(c: Int)
case class BW(d: Double)
case class PD(sw: SW, iw: IW, bw: BW)
@template((i: Int, s: String, d: Double) => PD(SW(s), IW(i), BW(d)))
object Test2 {
def typeToString[T](o: T)(implicit t: TypeTag[T]) = t.tpe.toString
val appl = apply(2, "sss", 2d)
val unappl = unapply(PD(SW("s"), IW(1100), BW(28d)))
println(s"apply: ${appl}: ${typeToString(appl)}")
println(s"unapply: ${unappl}: ${typeToString(unappl)}")
}
object Test extends App {
println(Test2.appl)
println(Test2.unappl)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment