Created
November 19, 2015 10:31
-
-
Save pomadchin/d4fedf578729c2cb3aff to your computer and use it in GitHub Desktop.
Example of the correct values call.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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