@@ -242,31 +242,31 @@ class PCPCheckAndHeal2(@constructorOnly ictx: Context) extends TreeMapWithStages
242
242
object PCPCheckAndHeal2 {
243
243
import tpd ._
244
244
245
- // class QuoteTypeTags(span: Span)(using Context) {
246
-
247
- // private val tags = collection.mutable.LinkedHashMap.empty[Symbol, TypeDef]
248
-
249
- // def getTagRef(spliced: TermRef): TypeRef = {
250
- // val typeDef = tags.getOrElseUpdate(spliced.symbol, mkTagSymbolAndAssignType(spliced))
251
- // typeDef.symbol.typeRef
252
- // }
253
-
254
- // def getTypeTags: List[TypeDef] = tags.valuesIterator.toList
255
-
256
- // private def mkTagSymbolAndAssignType(spliced: TermRef): TypeDef = {
257
- // val splicedTree = tpd.ref(spliced).withSpan(span)
258
- // val rhs = splicedTree.select(tpnme.splice).withSpan(span)
259
- // val alias = ctx.typeAssigner.assignType(untpd.TypeBoundsTree(rhs, rhs), rhs, rhs, EmptyTree)
260
- // val local = ctx.newSymbol(
261
- // owner = ctx.owner,
262
- // name = UniqueName.fresh((splicedTree.symbol.name.toString + "$_").toTermName).toTypeName,
263
- // flags = Synthetic,
264
- // info = TypeAlias(splicedTree.tpe.select(tpnme.splice)),
265
- // coord = span).asType
266
- // local.addAnnotation(Annotation(defn.InternalQuoted_QuoteTypeTagAnnot))
267
- // ctx.typeAssigner.assignType(untpd.TypeDef(local.name, alias), local)
268
- // }
269
-
270
- // }
245
+ class QuoteTypeTags (span : Span )(using Context ) {
246
+
247
+ private val tags = collection.mutable.LinkedHashMap .empty[Symbol , TypeDef ]
248
+
249
+ def getTagRef (spliced : TermRef ): TypeRef = {
250
+ val typeDef = tags.getOrElseUpdate(spliced.symbol, mkTagSymbolAndAssignType(spliced))
251
+ typeDef.symbol.typeRef
252
+ }
253
+
254
+ def getTypeTags : List [TypeDef ] = tags.valuesIterator.toList
255
+
256
+ private def mkTagSymbolAndAssignType (spliced : TermRef ): TypeDef = {
257
+ val splicedTree = tpd.ref(spliced).withSpan(span)
258
+ val rhs = splicedTree.select(tpnme.splice).withSpan(span)
259
+ val alias = ctx.typeAssigner.assignType(untpd.TypeBoundsTree (rhs, rhs), rhs, rhs, EmptyTree )
260
+ val local = ctx.newSymbol(
261
+ owner = ctx.owner,
262
+ name = UniqueName .fresh((splicedTree.symbol.name.toString + " $_" ).toTermName).toTypeName,
263
+ flags = Synthetic ,
264
+ info = TypeAlias (splicedTree.tpe.select(tpnme.splice)),
265
+ coord = span).asType
266
+ local.addAnnotation(Annotation (defn.InternalQuoted_QuoteTypeTagAnnot ))
267
+ ctx.typeAssigner.assignType(untpd.TypeDef (local.name, alias), local)
268
+ }
269
+
270
+ }
271
271
272
272
}
0 commit comments