Skip to content

Commit 1fe9555

Browse files
Merge pull request #7473 from dotty-staging/flatten-tasty-reflect-type
Extract modules in reflection Type
2 parents e7f67c7 + 948b9dd commit 1fe9555

File tree

24 files changed

+434
-435
lines changed

24 files changed

+434
-435
lines changed

library/src/scala/tasty/reflect/ExtractorsPrinter.scala

+36-36
Original file line numberDiff line numberDiff line change
@@ -183,43 +183,43 @@ class ExtractorsPrinter[R <: Reflection & Singleton](val tasty: R) extends Print
183183
}
184184

185185
def visitType(x: TypeOrBounds): Buffer = x match {
186-
case Type.ConstantType(value) =>
187-
this += "Type.ConstantType(" += value += ")"
188-
case Type.TermRef(qual, name) =>
189-
this += "Type.TermRef(" += qual+= ", \"" += name += "\")"
190-
case Type.TypeRef(qual, name) =>
191-
this += "Type.TypeRef(" += qual += ", \"" += name += "\")"
192-
case Type.Refinement(parent, name, info) =>
193-
this += "Type.Refinement(" += parent += ", " += name += ", " += info += ")"
194-
case Type.AppliedType(tycon, args) =>
195-
this += "Type.AppliedType(" += tycon += ", " ++= args += ")"
196-
case Type.AnnotatedType(underlying, annot) =>
197-
this += "Type.AnnotatedType(" += underlying += ", " += annot += ")"
198-
case Type.AndType(left, right) =>
199-
this += "Type.AndType(" += left += ", " += right += ")"
200-
case Type.OrType(left, right) =>
201-
this += "Type.OrType(" += left += ", " += right += ")"
202-
case Type.MatchType(bound, scrutinee, cases) =>
203-
this += "Type.MatchType(" += bound += ", " += scrutinee += ", " ++= cases += ")"
204-
case Type.ByNameType(underlying) =>
205-
this += "Type.ByNameType(" += underlying += ")"
206-
case Type.ParamRef(binder, idx) =>
207-
this += "Type.ParamRef(" += binder += ", " += idx += ")"
208-
case Type.ThisType(tp) =>
209-
this += "Type.ThisType(" += tp += ")"
210-
case Type.SuperType(thistpe, supertpe) =>
211-
this += "Type.SuperType(" += thistpe += ", " += supertpe += ")"
212-
case Type.RecursiveThis(binder) =>
213-
this += "Type.RecursiveThis(" += binder += ")"
214-
case Type.RecursiveType(underlying) =>
215-
this += "Type.RecursiveType(" += underlying += ")"
216-
case Type.MethodType(argNames, argTypes, resType) =>
217-
this += "Type.MethodType(" ++= argNames += ", " ++= argTypes += ", " += resType += ")"
218-
case Type.PolyType(argNames, argBounds, resType) =>
219-
this += "Type.PolyType(" ++= argNames += ", " ++= argBounds += ", " += resType += ")"
220-
case Type.TypeLambda(argNames, argBounds, resType) =>
186+
case ConstantType(value) =>
187+
this += "ConstantType(" += value += ")"
188+
case TermRef(qual, name) =>
189+
this += "TermRef(" += qual+= ", \"" += name += "\")"
190+
case TypeRef(qual, name) =>
191+
this += "TypeRef(" += qual += ", \"" += name += "\")"
192+
case Refinement(parent, name, info) =>
193+
this += "Refinement(" += parent += ", " += name += ", " += info += ")"
194+
case AppliedType(tycon, args) =>
195+
this += "AppliedType(" += tycon += ", " ++= args += ")"
196+
case AnnotatedType(underlying, annot) =>
197+
this += "AnnotatedType(" += underlying += ", " += annot += ")"
198+
case AndType(left, right) =>
199+
this += "AndType(" += left += ", " += right += ")"
200+
case OrType(left, right) =>
201+
this += "OrType(" += left += ", " += right += ")"
202+
case MatchType(bound, scrutinee, cases) =>
203+
this += "MatchType(" += bound += ", " += scrutinee += ", " ++= cases += ")"
204+
case ByNameType(underlying) =>
205+
this += "ByNameType(" += underlying += ")"
206+
case ParamRef(binder, idx) =>
207+
this += "ParamRef(" += binder += ", " += idx += ")"
208+
case ThisType(tp) =>
209+
this += "ThisType(" += tp += ")"
210+
case SuperType(thistpe, supertpe) =>
211+
this += "SuperType(" += thistpe += ", " += supertpe += ")"
212+
case RecursiveThis(binder) =>
213+
this += "RecursiveThis(" += binder += ")"
214+
case RecursiveType(underlying) =>
215+
this += "RecursiveType(" += underlying += ")"
216+
case MethodType(argNames, argTypes, resType) =>
217+
this += "MethodType(" ++= argNames += ", " ++= argTypes += ", " += resType += ")"
218+
case PolyType(argNames, argBounds, resType) =>
219+
this += "PolyType(" ++= argNames += ", " ++= argBounds += ", " += resType += ")"
220+
case TypeLambda(argNames, argBounds, resType) =>
221221
// resType is not printed to avoid cycles
222-
this += "Type.TypeLambda(" ++= argNames += ", " ++= argBounds += ", _)"
222+
this += "TypeLambda(" ++= argNames += ", " ++= argBounds += ", _)"
223223
case TypeBounds(lo, hi) =>
224224
this += "TypeBounds(" += lo += ", " += hi += ")"
225225
case NoPrefix() =>

0 commit comments

Comments
 (0)