Created
October 6, 2019 21:05
-
-
Save lbialy/bba3b58ea4ecabcbeed7e57792b8e325 to your computer and use it in GitHub Desktop.
Checking whether native-image is fine with non-evaluated Lazy[TypeTag[A]] guards
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 scala.reflect.runtime.universe.TypeTag | |
import shapeless._ | |
object LazyTypeTagGuardTest { | |
case class Whatever() | |
type X | |
def f[A](xd: A)(implicit ev: Lazy[TypeTag[A]]) = ev.value.tpe.toString | |
final def main(args: Array[String]): Unit = { | |
lazy val test = f(Whatever()) | |
lazy val test2 = f(Array.empty[Int]) | |
// lazy val test3 = f[X](???) // does not compile: No TypeTag available for Test.X | |
println("Hello world") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment