File tree Expand file tree Collapse file tree 3 files changed +17
-3
lines changed
compiler/src/dotty/tools/dotc/tastyreflect
library/src/scala/tasty/reflect
tests/run-with-compiler/i5941 Expand file tree Collapse file tree 3 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -383,8 +383,8 @@ trait TreeOpsImpl extends scala.tasty.reflect.TreeOps with RootPositionImpl with
383383 }
384384
385385 object Ident extends IdentModule {
386- def apply (tmref : TermRef )(implicit ctx : Context ): Ident =
387- withDefaultPos(implicit ctx => tpd.Ident (tmref))
386+ def apply (tmref : TermRef )(implicit ctx : Context ): Term =
387+ withDefaultPos(implicit ctx => tpd.ref (tmref). asInstanceOf [ Term ] )
388388
389389 def copy (original : Tree )(name : String )(implicit ctx : Context ): Ident =
390390 tpd.cpy.Ident (original)(name.toTermName)
Original file line number Diff line number Diff line change @@ -248,7 +248,7 @@ trait TreeOps extends Core {
248248 /** Scala term identifier */
249249 val Ident : IdentModule
250250 abstract class IdentModule {
251- def apply (tmref : TermRef )(implicit ctx : Context ): Ident
251+ def apply (tmref : TermRef )(implicit ctx : Context ): Term
252252
253253 def copy (original : Tree )(name : String )(implicit ctx : Context ): Ident
254254
Original file line number Diff line number Diff line change @@ -40,5 +40,19 @@ object Test {
4040 assert(jNum(3.5 ) == JNum (3.5 ))
4141 assert(jNum.getOption(JNum (3.5 )) == Some (3.5 ))
4242 assert(jNum.getOption(JNull ) == None )
43+
44+ // inner classes
45+ val inner = new Inner
46+ assert(GenIso [inner.JStr , String ].to(inner.JStr (" Hello" )) == " Hello" )
47+ assert(GenIso .unit[inner.JNull .type ].to(inner.JNull ) == 1 )
48+ assert(GenIso .unit[inner.JNull .type ].from(1 ) == inner.JNull )
4349 }
50+ }
51+
52+ class Inner {
53+ sealed trait Json
54+ case object JNull extends Json
55+ case class JStr (v : String ) extends Json
56+ case class JNum (v : Double ) extends Json
57+ case class JObj (v : Map [String , Json ]) extends Json
4458}
You can’t perform that action at this time.
0 commit comments