File tree Expand file tree Collapse file tree 6 files changed +16
-15
lines changed
src/dotty/tools/dotc/tastyreflect Expand file tree Collapse file tree 6 files changed +16
-15
lines changed Original file line number Diff line number Diff line change @@ -1072,6 +1072,12 @@ class TastyImpl(val rootContext: Contexts.Context) extends scala.tasty.Tasty { s
1072
1072
}
1073
1073
}
1074
1074
1075
+ object Symbol extends SymbolExtractor {
1076
+ def unapply (x : Constant ): Option [scala.Symbol ] = x match {
1077
+ case x : Constants .Constant if x.tag == Constants .ScalaSymbolTag => Some (x.scalaSymbolValue)
1078
+ case _ => None
1079
+ }
1080
+ }
1075
1081
}
1076
1082
1077
1083
// ===== Signature ================================================
Original file line number Diff line number Diff line change 1
- # Constant(Symbol)
2
- desugar.scala
3
- sip23-symbols.scala
4
- t389.scala
5
- t4812.scala
6
- t4579.scala
7
-
8
1
# assertion failed: asTerm called on not-a-Term val <none>
9
2
cls.scala
10
3
escapes2.scala
Original file line number Diff line number Diff line change @@ -32,14 +32,6 @@ t3651.scala
32
32
protectedacc.scala
33
33
t7436.scala
34
34
35
- # Constant(Symbol)
36
- fors.scala
37
- t6634.scala
38
- t6632.scala
39
- t4601.scala
40
- t6633.scala
41
- arrays.scala
42
-
43
35
# scala.MatchError: SeqLiteral in pattern
44
36
i3248.scala
45
37
t6541.scala
Original file line number Diff line number Diff line change @@ -825,6 +825,13 @@ abstract class Tasty { tasty =>
825
825
abstract class ClassTagExtractor {
826
826
def unapply (x : Constant ): Option [Type ]
827
827
}
828
+
829
+ /** Extractor for scala.Symbol literals */
830
+ val Symbol : SymbolExtractor
831
+ /** Extractor for scala.Symbol literals */
832
+ abstract class SymbolExtractor {
833
+ def unapply (x : Constant ): Option [scala.Symbol ]
834
+ }
828
835
}
829
836
830
837
// ===== Signature ================================================
Original file line number Diff line number Diff line change @@ -153,6 +153,7 @@ class ShowExtractors[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
153
153
case Constant .Double (value) => this += " Constant.Double(" += value += " )"
154
154
case Constant .String (value) => this += " Constant.String(\" " += value += " \" )"
155
155
case Constant .ClassTag (value) => this += " Constant.ClassTag(" += value += " )"
156
+ case Constant .Symbol (value) => this += " Constant.Symbol('" += value.name += " )"
156
157
}
157
158
158
159
def visitType (x : TypeOrBounds ): Buffer = x match {
Original file line number Diff line number Diff line change @@ -722,6 +722,8 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
722
722
case Constant .ClassTag (v) =>
723
723
this += " classOf"
724
724
inSquare(printType(v))
725
+ case Constant .Symbol (v) =>
726
+ this += " '" += v.name
725
727
}
726
728
727
729
def printTypeOrBoundsTree (tpt : TypeOrBoundsTree ): Buffer = tpt match {
You can’t perform that action at this time.
0 commit comments