diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/files/run/reify_typeof.check | 10 | ||||
-rw-r--r-- | test/files/run/reify_typeof.scala | 14 | ||||
-rw-r--r-- | test/files/run/typetags_typeof_x.check | 8 | ||||
-rw-r--r-- | test/files/run/typetags_typeof_x.scala | 14 |
4 files changed, 46 insertions, 0 deletions
diff --git a/test/files/run/reify_typeof.check b/test/files/run/reify_typeof.check new file mode 100644 index 0000000000..670f76faa4 --- /dev/null +++ b/test/files/run/reify_typeof.check @@ -0,0 +1,10 @@ +Expr[Unit]({ + val ru = `package`.universe; + val tpe1: ru.Type = ru.typeOf[`package`.List[Int]]; + Predef.println(tpe1); + val tpe2: ru.Type = ru.typeOf(List.apply(1, 2, 3)); + Predef.println(tpe2) +}) +scala.List[Int] +List[Int] +() diff --git a/test/files/run/reify_typeof.scala b/test/files/run/reify_typeof.scala new file mode 100644 index 0000000000..985c57b9ab --- /dev/null +++ b/test/files/run/reify_typeof.scala @@ -0,0 +1,14 @@ +import scala.reflect.runtime.universe._ +import scala.tools.reflect.Eval + +object Test extends App { + val reified = reify { + val ru = scala.reflect.runtime.universe + val tpe1: ru.Type = ru.typeOf[List[Int]] + println(tpe1) + val tpe2: ru.Type = ru.typeOf(List(1, 2, 3)) + println(tpe2) + } + println(reified) + println(reified.eval) +}
\ No newline at end of file diff --git a/test/files/run/typetags_typeof_x.check b/test/files/run/typetags_typeof_x.check new file mode 100644 index 0000000000..832a8bc63c --- /dev/null +++ b/test/files/run/typetags_typeof_x.check @@ -0,0 +1,8 @@ +List[T] +C +Int +List[Any] +AnyRef{def x: Int} +Null +Nothing +Null diff --git a/test/files/run/typetags_typeof_x.scala b/test/files/run/typetags_typeof_x.scala new file mode 100644 index 0000000000..08be6d4527 --- /dev/null +++ b/test/files/run/typetags_typeof_x.scala @@ -0,0 +1,14 @@ +import scala.reflect.runtime.universe._ + +object Test extends App { + def foo[T](x: T) = weakTypeOf(List(x)) + println(foo(2)) + locally { class C; println(weakTypeOf(new C)) } + + println(typeOf(2)) + println(typeOf(List(1, "1"))) + println(typeOf(new { def x = 2 })) + println(typeOf[Null]) + println(typeOf[Nothing]) + println(typeOf(null)) +}
\ No newline at end of file |