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 {
81
81
}
82
82
83
83
/** Default implemetation of `ToExpr[Class[T]]` */
84
- given ClassToExpr [T <: Class [_ ]]: ToExpr [T ] with {
84
+ given ClassToExpr [T <: Class [? ]]: ToExpr [T ] with {
85
85
def apply (x : T )(using Quotes ) = {
86
86
import quotes .reflect ._
87
87
Ref (defn.Predef_classOf ).appliedToType(TypeRepr .typeConstructorOf(x)).asExpr.asInstanceOf [Expr [T ]]
Original file line number Diff line number Diff line change 1
1
import scala .quoted ._
2
2
3
- inline def wildcard : Map [String , Class [_ ]] = $ { wildcardMacro }
3
+ inline def wildcard : Map [String , Class [? ]] = $ { wildcardMacro }
4
4
inline def noWildcard : Map [String , Class [Int ]] = $ { noWildcardMacro }
5
5
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 (
8
8
" foo" -> classOf [Long ],
9
9
" bar" -> classOf [Int ]
10
10
)
Original file line number Diff line number Diff line change 1
1
object Test {
2
2
def main (args : Array [String ]): Unit = {
3
- val a : Map [String , Class [_ ]] = wildcard
3
+ val a : Map [String , Class [? ]] = wildcard
4
4
val b : Map [String , Class [Int ]] = noWildcard
5
5
println(a(" foo" ))
6
6
println(a(" bar" ))
You can’t perform that action at this time.
0 commit comments