Created
April 16, 2020 22:47
-
-
Save erikerlandson/62d53a7cb0e09583952223ad8dcf898e to your computer and use it in GitHub Desktop.
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
scala> def foo[T <: Singleton](ce: T)(implicit tt: WeakTypeTag[T]): String = tt.tpe.toString | |
foo: [T <: Singleton](ce: T)(implicit tt: reflect.runtime.universe.WeakTypeTag[T])String | |
scala> foo(5) | |
res37: String = Int(5) | |
scala> foo("abc") | |
res38: String = String("abc") | |
scala> val x = 5 | |
x: Int = 5 | |
scala> foo(x) | |
res39: String = x.type |
Author
erikerlandson
commented
Apr 17, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment