diff --git a/tests/run-with-compiler/i3947b.check b/tests/run-with-compiler/i3947b.check index decf57290735..dd712b7023e2 100644 --- a/tests/run-with-compiler/i3947b.check +++ b/tests/run-with-compiler/i3947b.check @@ -7,21 +7,3 @@ byte classOf[Char].getCanonicalName() char - -classOf[Short].getCanonicalName() -short - -classOf[Int].getCanonicalName() -int - -classOf[Long].getCanonicalName() -long - -classOf[Float].getCanonicalName() -float - -classOf[Double].getCanonicalName() -double - -classOf[Unit].getCanonicalName() -void diff --git a/tests/run-with-compiler/i3947b.scala b/tests/run-with-compiler/i3947b.scala index 404c7980aba2..365dd7e0085d 100644 --- a/tests/run-with-compiler/i3947b.scala +++ b/tests/run-with-compiler/i3947b.scala @@ -18,12 +18,6 @@ object Test { test(classOf[Boolean]) test(classOf[Byte]) test(classOf[Char]) - test(classOf[Short]) - test(classOf[Int]) - test(classOf[Long]) - test(classOf[Float]) - test(classOf[Double]) - test(classOf[Unit]) } } diff --git a/tests/run-with-compiler/i3947b2.check b/tests/run-with-compiler/i3947b2.check new file mode 100644 index 000000000000..2b18c14d8b71 --- /dev/null +++ b/tests/run-with-compiler/i3947b2.check @@ -0,0 +1,9 @@ + +classOf[Short].getCanonicalName() +short + +classOf[Int].getCanonicalName() +int + +classOf[Long].getCanonicalName() +long diff --git a/tests/run-with-compiler/i3947b2.scala b/tests/run-with-compiler/i3947b2.scala new file mode 100644 index 000000000000..0e536e0a224e --- /dev/null +++ b/tests/run-with-compiler/i3947b2.scala @@ -0,0 +1,23 @@ + +import scala.quoted._ +import dotty.tools.dotc.quoted.Toolbox._ + +object Test { + + def main(args: Array[String]): Unit = { + + def test[T](clazz: java.lang.Class[T]): Unit = { + val lclazz = clazz.toExpr + val name = '{ (~lclazz).getCanonicalName } + println() + println(name.show) + println(name.run) + } + + // primitives + test(classOf[Short]) + test(classOf[Int]) + test(classOf[Long]) + } + +} diff --git a/tests/run-with-compiler/i3947b3.check b/tests/run-with-compiler/i3947b3.check new file mode 100644 index 000000000000..074ba0e0693d --- /dev/null +++ b/tests/run-with-compiler/i3947b3.check @@ -0,0 +1,9 @@ + +classOf[Float].getCanonicalName() +float + +classOf[Double].getCanonicalName() +double + +classOf[Unit].getCanonicalName() +void diff --git a/tests/run-with-compiler/i3947b3.scala b/tests/run-with-compiler/i3947b3.scala new file mode 100644 index 000000000000..a701166caaa9 --- /dev/null +++ b/tests/run-with-compiler/i3947b3.scala @@ -0,0 +1,23 @@ + +import scala.quoted._ +import dotty.tools.dotc.quoted.Toolbox._ + +object Test { + + def main(args: Array[String]): Unit = { + + def test[T](clazz: java.lang.Class[T]): Unit = { + val lclazz = clazz.toExpr + val name = '{ (~lclazz).getCanonicalName } + println() + println(name.show) + println(name.run) + } + + // primitives + test(classOf[Float]) + test(classOf[Double]) + test(classOf[Unit]) + } + +} diff --git a/tests/run-with-compiler/i3947d.check b/tests/run-with-compiler/i3947d.check index 075a44674d87..c54f219fedfc 100644 --- a/tests/run-with-compiler/i3947d.check +++ b/tests/run-with-compiler/i3947d.check @@ -7,12 +7,3 @@ Foo.Bar classOf[Foo.Baz].getCanonicalName() Foo.Baz - -classOf[foo.Foo].getCanonicalName() -foo.Foo - -classOf[foo.Foo#Bar].getCanonicalName() -foo.Foo.Bar - -classOf[foo.Foo.Baz].getCanonicalName() -foo.Foo.Baz diff --git a/tests/run-with-compiler/i3947d.scala b/tests/run-with-compiler/i3947d.scala index 74dfd0089a32..63977a8f6543 100644 --- a/tests/run-with-compiler/i3947d.scala +++ b/tests/run-with-compiler/i3947d.scala @@ -17,10 +17,6 @@ object Test { test(classOf[Foo]) test(classOf[Foo#Bar]) test(classOf[Foo.Baz]) - - test(classOf[foo.Foo]) - test(classOf[foo.Foo#Bar]) - test(classOf[foo.Foo.Baz]) } } @@ -32,12 +28,3 @@ class Foo { object Foo { class Baz } - -package foo { - class Foo { - class Bar - } - object Foo { - class Baz - } -} diff --git a/tests/run-with-compiler/i3947d2.check b/tests/run-with-compiler/i3947d2.check new file mode 100644 index 000000000000..e0caebc39549 --- /dev/null +++ b/tests/run-with-compiler/i3947d2.check @@ -0,0 +1,9 @@ + +classOf[foo.Foo].getCanonicalName() +foo.Foo + +classOf[foo.Foo#Bar].getCanonicalName() +foo.Foo.Bar + +classOf[foo.Foo.Baz].getCanonicalName() +foo.Foo.Baz diff --git a/tests/run-with-compiler/i3947d2.scala b/tests/run-with-compiler/i3947d2.scala new file mode 100644 index 000000000000..3c4ea585b4e7 --- /dev/null +++ b/tests/run-with-compiler/i3947d2.scala @@ -0,0 +1,31 @@ + +import scala.quoted._ +import dotty.tools.dotc.quoted.Toolbox._ + +object Test { + + def main(args: Array[String]): Unit = { + + def test[T](clazz: java.lang.Class[T]): Unit = { + val lclazz = clazz.toExpr + val name = '{ (~lclazz).getCanonicalName } + println() + println(name.show) + println(name.run) + } + + test(classOf[foo.Foo]) + test(classOf[foo.Foo#Bar]) + test(classOf[foo.Foo.Baz]) + } + +} + +package foo { + class Foo { + class Bar + } + object Foo { + class Baz + } +}