File tree Expand file tree Collapse file tree 10 files changed +104
-46
lines changed Expand file tree Collapse file tree 10 files changed +104
-46
lines changed Original file line number Diff line number Diff line change 77
88classOf[Char].getCanonicalName()
99char
10-
11- classOf[Short].getCanonicalName()
12- short
13-
14- classOf[Int].getCanonicalName()
15- int
16-
17- classOf[Long].getCanonicalName()
18- long
19-
20- classOf[Float].getCanonicalName()
21- float
22-
23- classOf[Double].getCanonicalName()
24- double
25-
26- classOf[Unit].getCanonicalName()
27- void
Original file line number Diff line number Diff line change @@ -18,12 +18,6 @@ object Test {
1818 test(classOf [Boolean ])
1919 test(classOf [Byte ])
2020 test(classOf [Char ])
21- test(classOf [Short ])
22- test(classOf [Int ])
23- test(classOf [Long ])
24- test(classOf [Float ])
25- test(classOf [Double ])
26- test(classOf [Unit ])
2721 }
2822
2923}
Original file line number Diff line number Diff line change 1+
2+ classOf[Short].getCanonicalName()
3+ short
4+
5+ classOf[Int].getCanonicalName()
6+ int
7+
8+ classOf[Long].getCanonicalName()
9+ long
Original file line number Diff line number Diff line change 1+
2+ import scala .quoted ._
3+ import dotty .tools .dotc .quoted .Toolbox ._
4+
5+ object Test {
6+
7+ def main (args : Array [String ]): Unit = {
8+
9+ def test [T ](clazz : java.lang.Class [T ]): Unit = {
10+ val lclazz = clazz.toExpr
11+ val name = ' { (~ lclazz).getCanonicalName }
12+ println()
13+ println(name.show)
14+ println(name.run)
15+ }
16+
17+ // primitives
18+ test(classOf [Short ])
19+ test(classOf [Int ])
20+ test(classOf [Long ])
21+ }
22+
23+ }
Original file line number Diff line number Diff line change 1+
2+ classOf[Float].getCanonicalName()
3+ float
4+
5+ classOf[Double].getCanonicalName()
6+ double
7+
8+ classOf[Unit].getCanonicalName()
9+ void
Original file line number Diff line number Diff line change 1+
2+ import scala .quoted ._
3+ import dotty .tools .dotc .quoted .Toolbox ._
4+
5+ object Test {
6+
7+ def main (args : Array [String ]): Unit = {
8+
9+ def test [T ](clazz : java.lang.Class [T ]): Unit = {
10+ val lclazz = clazz.toExpr
11+ val name = ' { (~ lclazz).getCanonicalName }
12+ println()
13+ println(name.show)
14+ println(name.run)
15+ }
16+
17+ // primitives
18+ test(classOf [Float ])
19+ test(classOf [Double ])
20+ test(classOf [Unit ])
21+ }
22+
23+ }
Original file line number Diff line number Diff line change 77
88classOf[Foo.Baz].getCanonicalName()
99Foo.Baz
10-
11- classOf[foo.Foo].getCanonicalName()
12- foo.Foo
13-
14- classOf[foo.Foo#Bar].getCanonicalName()
15- foo.Foo.Bar
16-
17- classOf[foo.Foo.Baz].getCanonicalName()
18- foo.Foo.Baz
Original file line number Diff line number Diff line change @@ -17,10 +17,6 @@ object Test {
1717 test(classOf [Foo ])
1818 test(classOf [Foo # Bar ])
1919 test(classOf [Foo .Baz ])
20-
21- test(classOf [foo.Foo ])
22- test(classOf [foo.Foo # Bar ])
23- test(classOf [foo.Foo .Baz ])
2420 }
2521
2622}
@@ -32,12 +28,3 @@ class Foo {
3228object Foo {
3329 class Baz
3430}
35-
36- package foo {
37- class Foo {
38- class Bar
39- }
40- object Foo {
41- class Baz
42- }
43- }
Original file line number Diff line number Diff line change 1+
2+ classOf[foo.Foo].getCanonicalName()
3+ foo.Foo
4+
5+ classOf[foo.Foo#Bar].getCanonicalName()
6+ foo.Foo.Bar
7+
8+ classOf[foo.Foo.Baz].getCanonicalName()
9+ foo.Foo.Baz
Original file line number Diff line number Diff line change 1+
2+ import scala .quoted ._
3+ import dotty .tools .dotc .quoted .Toolbox ._
4+
5+ object Test {
6+
7+ def main (args : Array [String ]): Unit = {
8+
9+ def test [T ](clazz : java.lang.Class [T ]): Unit = {
10+ val lclazz = clazz.toExpr
11+ val name = ' { (~ lclazz).getCanonicalName }
12+ println()
13+ println(name.show)
14+ println(name.run)
15+ }
16+
17+ test(classOf [foo.Foo ])
18+ test(classOf [foo.Foo # Bar ])
19+ test(classOf [foo.Foo .Baz ])
20+ }
21+
22+ }
23+
24+ package foo {
25+ class Foo {
26+ class Bar
27+ }
28+ object Foo {
29+ class Baz
30+ }
31+ }
You can’t perform that action at this time.
0 commit comments