File tree Expand file tree Collapse file tree 3 files changed +5
-5
lines changed
tests/run-macros/quoted-toExprOfClass Expand file tree Collapse file tree 3 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ object ToExpr {
8181 }
8282
8383 /** Default implemetation of `ToExpr[Class[T]]` */
84- given ClassToExpr [T <: Class [_ ]]: ToExpr [T ] with {
84+ given ClassToExpr [T <: Class [? ]]: ToExpr [T ] with {
8585 def apply (x : T )(using Quotes ) = {
8686 import quotes .reflect ._
8787 Ref (defn.Predef_classOf ).appliedToType(TypeRepr .typeConstructorOf(x)).asExpr.asInstanceOf [Expr [T ]]
Original file line number Diff line number Diff line change 11import scala .quoted ._
22
3- inline def wildcard : Map [String , Class [_ ]] = $ { wildcardMacro }
3+ inline def wildcard : Map [String , Class [? ]] = $ { wildcardMacro }
44inline def noWildcard : Map [String , Class [Int ]] = $ { noWildcardMacro }
55
6- def wildcardMacro (using Quotes ): Expr [Map [String , Class [_ ]]] = {
7- val result : Map [String , Class [_ ]] = Map (
6+ def wildcardMacro (using Quotes ): Expr [Map [String , Class [? ]]] = {
7+ val result : Map [String , Class [? ]] = Map (
88 " foo" -> classOf [Long ],
99 " bar" -> classOf [Int ]
1010 )
Original file line number Diff line number Diff line change 11object Test {
22 def main (args : Array [String ]): Unit = {
3- val a : Map [String , Class [_ ]] = wildcard
3+ val a : Map [String , Class [? ]] = wildcard
44 val b : Map [String , Class [Int ]] = noWildcard
55 println(a(" foo" ))
66 println(a(" bar" ))
You can’t perform that action at this time.
0 commit comments