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
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
383
383
}
384
384
385
385
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 ] )
388
388
389
389
def copy (original : Tree )(name : String )(implicit ctx : Context ): Ident =
390
390
tpd.cpy.Ident (original)(name.toTermName)
Original file line number Diff line number Diff line change @@ -248,7 +248,7 @@ trait TreeOps extends Core {
248
248
/** Scala term identifier */
249
249
val Ident : IdentModule
250
250
abstract class IdentModule {
251
- def apply (tmref : TermRef )(implicit ctx : Context ): Ident
251
+ def apply (tmref : TermRef )(implicit ctx : Context ): Term
252
252
253
253
def copy (original : Tree )(name : String )(implicit ctx : Context ): Ident
254
254
Original file line number Diff line number Diff line change @@ -40,5 +40,19 @@ object Test {
40
40
assert(jNum(3.5 ) == JNum (3.5 ))
41
41
assert(jNum.getOption(JNum (3.5 )) == Some (3.5 ))
42
42
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 )
43
49
}
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
44
58
}
You can’t perform that action at this time.
0 commit comments