@@ -123,7 +123,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util.
123123 else self.symbol.info.decls.iterator.map(definitionFromSym).toList
124124 }
125125
126- def PackageDef_symbol (self : PackageDef )(implicit ctx : Context ): PackageSymbol = self.symbol
126+ def PackageDef_symbol (self : PackageDef )(implicit ctx : Context ): PackageDefSymbol = self.symbol
127127
128128 type ClassDef = tpd.TypeDef
129129
@@ -137,7 +137,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util.
137137 def ClassDef_derived (self : ClassDef )(implicit ctx : Context ): List [TypeTree ] = ClassDef_rhs (self).derived.asInstanceOf [List [TypeTree ]]
138138 def ClassDef_self (self : ClassDef )(implicit ctx : Context ): Option [ValDef ] = optional(ClassDef_rhs (self).self)
139139 def ClassDef_body (self : ClassDef )(implicit ctx : Context ): List [Statement ] = ClassDef_rhs (self).body
140- def ClassDef_symbol (self : ClassDef )(implicit ctx : Context ): ClassSymbol = self.symbol.asClass
140+ def ClassDef_symbol (self : ClassDef )(implicit ctx : Context ): ClassDefSymbol = self.symbol.asClass
141141 private def ClassDef_rhs (self : ClassDef ) = self.rhs.asInstanceOf [tpd.Template ]
142142
143143 def ClassDef_copy (original : ClassDef )(name : String , constr : DefDef , parents : List [Tree /* Term | TypeTree */ ], derived : List [TypeTree ], selfOpt : Option [ValDef ], body : List [Statement ])(implicit ctx : Context ): ClassDef = {
@@ -153,9 +153,9 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util.
153153 }
154154
155155 def TypeDef_rhs (self : TypeDef )(implicit ctx : Context ): Tree /* TypeTree | TypeBoundsTree*/ = self.rhs
156- def TypeDef_symbol (self : TypeDef )(implicit ctx : Context ): TypeSymbol = self.symbol.asType
156+ def TypeDef_symbol (self : TypeDef )(implicit ctx : Context ): TypeDefSymbol = self.symbol.asType
157157
158- def TypeDef_apply (symbol : TypeSymbol )(implicit ctx : Context ): TypeDef = withDefaultPos(ctx => tpd.TypeDef (symbol)(ctx))
158+ def TypeDef_apply (symbol : TypeDefSymbol )(implicit ctx : Context ): TypeDef = withDefaultPos(ctx => tpd.TypeDef (symbol)(ctx))
159159 def TypeDef_copy (original : TypeDef )(name : String , rhs : Tree /* TypeTree | TypeBoundsTree*/ )(implicit ctx : Context ): TypeDef =
160160 tpd.cpy.TypeDef (original)(name.toTypeName, rhs)
161161
@@ -170,9 +170,9 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util.
170170 def DefDef_paramss (self : DefDef )(implicit ctx : Context ): List [List [ValDef ]] = self.vparamss
171171 def DefDef_returnTpt (self : DefDef )(implicit ctx : Context ): TypeTree = self.tpt
172172 def DefDef_rhs (self : DefDef )(implicit ctx : Context ): Option [Tree ] = optional(self.rhs)
173- def DefDef_symbol (self : DefDef )(implicit ctx : Context ): DefSymbol = self.symbol.asTerm
173+ def DefDef_symbol (self : DefDef )(implicit ctx : Context ): DefDefSymbol = self.symbol.asTerm
174174
175- def DefDef_apply (symbol : DefSymbol , rhsFn : List [Type ] => List [List [Term ]] => Option [Term ])(implicit ctx : Context ): DefDef =
175+ def DefDef_apply (symbol : DefDefSymbol , rhsFn : List [Type ] => List [List [Term ]] => Option [Term ])(implicit ctx : Context ): DefDef =
176176 withDefaultPos(ctx => tpd.polyDefDef(symbol, tparams => vparamss => rhsFn(tparams)(vparamss).getOrElse(tpd.EmptyTree ))(ctx))
177177
178178 def DefDef_copy (original : DefDef )(name : String , typeParams : List [TypeDef ], paramss : List [List [ValDef ]], tpt : TypeTree , rhs : Option [Term ])(implicit ctx : Context ): DefDef =
@@ -187,9 +187,9 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util.
187187
188188 def ValDef_tpt (self : ValDef )(implicit ctx : Context ): TypeTree = self.tpt
189189 def ValDef_rhs (self : ValDef )(implicit ctx : Context ): Option [Tree ] = optional(self.rhs)
190- def ValDef_symbol (self : ValDef )(implicit ctx : Context ): ValSymbol = self.symbol.asTerm
190+ def ValDef_symbol (self : ValDef )(implicit ctx : Context ): ValDefSymbol = self.symbol.asTerm
191191
192- def ValDef_apply (symbol : ValSymbol , rhs : Option [Term ])(implicit ctx : Context ): ValDef =
192+ def ValDef_apply (symbol : ValDefSymbol , rhs : Option [Term ])(implicit ctx : Context ): ValDef =
193193 tpd.ValDef (symbol, rhs.getOrElse(tpd.EmptyTree ))
194194
195195 def ValDef_copy (original : ValDef )(name : String , tpt : TypeTree , rhs : Option [Term ])(implicit ctx : Context ): ValDef =
@@ -278,7 +278,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util.
278278
279279 def This_id (self : This )(implicit ctx : Context ): Option [Id ] = optional(self.qual)
280280
281- def This_apply (cls : ClassSymbol )(implicit ctx : Context ): This =
281+ def This_apply (cls : ClassDefSymbol )(implicit ctx : Context ): This =
282282 withDefaultPos(ctx => tpd.This (cls)(ctx))
283283
284284 def This_copy (original : Tree )(qual : Option [Id ])(implicit ctx : Context ): This =
@@ -996,7 +996,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util.
996996
997997 def Type_dealias (self : Type )(implicit ctx : Context ): Type = self.dealias
998998
999- def Type_classSymbol (self : Type )(implicit ctx : Context ): Option [ClassSymbol ] =
999+ def Type_classSymbol (self : Type )(implicit ctx : Context ): Option [ClassDefSymbol ] =
10001000 if (self.classSymbol.exists) Some (self.classSymbol.asClass) else None
10011001
10021002 def Type_typeSymbol (self : Type )(implicit ctx : Context ): Symbol = self.typeSymbol
@@ -1427,49 +1427,54 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util.
14271427 def Symbol_isAbstractType (self : Symbol )(implicit ctx : Context ): Boolean = self.isAbstractType
14281428 def Symbol_isClassConstructor (self : Symbol )(implicit ctx : Context ): Boolean = self.isClassConstructor
14291429
1430- type PackageSymbol = core.Symbols .Symbol
1430+ type PackageDefSymbol = core.Symbols .Symbol
14311431
1432- def matchPackageSymbol (symbol : Symbol )(implicit ctx : Context ): Option [PackageSymbol ] =
1432+ def matchPackageDefSymbol (symbol : Symbol )(implicit ctx : Context ): Option [PackageDefSymbol ] =
14331433 if (symbol.is(core.Flags .Package )) Some (symbol) else None
14341434
1435- def PackageSymbol_tree (self : PackageSymbol )(implicit ctx : Context ): PackageDef =
1435+ def PackageDefSymbol_tree (self : PackageDefSymbol )(implicit ctx : Context ): PackageDef =
14361436 FromSymbol .packageDefFromSym(self)
14371437
1438- type ClassSymbol = core.Symbols .ClassSymbol
1438+ type TypeSymbol = core.Symbols .TypeSymbol
1439+
1440+ def matchTypeSymbol (symbol : Symbol )(implicit ctx : Context ): Option [TypeSymbol ] =
1441+ if (symbol.isType) Some (symbol.asType) else None
1442+
1443+ type ClassDefSymbol = core.Symbols .ClassSymbol
14391444
1440- def matchClassSymbol (symbol : Symbol )(implicit ctx : Context ): Option [ClassSymbol ] =
1445+ def matchClassDefSymbol (symbol : Symbol )(implicit ctx : Context ): Option [ClassDefSymbol ] =
14411446 if (symbol.isClass) Some (symbol.asClass) else None
14421447
1443- def ClassSymbol_tree (self : ClassSymbol )(implicit ctx : Context ): ClassDef =
1448+ def ClassDefSymbol_tree (self : ClassDefSymbol )(implicit ctx : Context ): ClassDef =
14441449 FromSymbol .classDef(self)
14451450
1446- def ClassSymbol_fields (self : Symbol )(implicit ctx : Context ): List [Symbol ] =
1451+ def ClassDefSymbol_fields (self : Symbol )(implicit ctx : Context ): List [Symbol ] =
14471452 self.unforcedDecls.filter(isField)
14481453
1449- def ClassSymbol_field (self : Symbol )(name : String )(implicit ctx : Context ): Option [Symbol ] = {
1454+ def ClassDefSymbol_field (self : Symbol )(name : String )(implicit ctx : Context ): Option [Symbol ] = {
14501455 val sym = self.unforcedDecls.find(sym => sym.name == name.toTermName)
14511456 if (sym.exists && isField(sym)) Some (sym) else None
14521457 }
14531458
1454- def ClassSymbol_classMethod (self : Symbol )(name : String )(implicit ctx : Context ): List [DefSymbol ] = {
1459+ def ClassDefSymbol_classMethod (self : Symbol )(name : String )(implicit ctx : Context ): List [DefDefSymbol ] = {
14551460 self.typeRef.decls.iterator.collect {
14561461 case sym if isMethod(sym) && sym.name.toString == name => sym.asTerm
14571462 }.toList
14581463 }
14591464
1460- def ClassSymbol_classMethods (self : Symbol )(implicit ctx : Context ): List [DefSymbol ] = {
1465+ def ClassDefSymbol_classMethods (self : Symbol )(implicit ctx : Context ): List [DefDefSymbol ] = {
14611466 self.typeRef.decls.iterator.collect {
14621467 case sym if isMethod(sym) => sym.asTerm
14631468 }.toList
14641469 }
14651470
1466- def ClassSymbol_method (self : Symbol )(name : String )(implicit ctx : Context ): List [DefSymbol ] = {
1471+ def ClassDefSymbol_method (self : Symbol )(name : String )(implicit ctx : Context ): List [DefDefSymbol ] = {
14671472 self.typeRef.allMembers.iterator.map(_.symbol).collect {
14681473 case sym if isMethod(sym) && sym.name.toString == name => sym.asTerm
14691474 }.toList
14701475 }
14711476
1472- def ClassSymbol_methods (self : Symbol )(implicit ctx : Context ): List [DefSymbol ] = {
1477+ def ClassDefSymbol_methods (self : Symbol )(implicit ctx : Context ): List [DefDefSymbol ] = {
14731478 self.typeRef.allMembers.iterator.map(_.symbol).collect {
14741479 case sym if isMethod(sym) => sym.asTerm
14751480 }.toList
@@ -1478,67 +1483,80 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util.
14781483 private def isMethod (sym : Symbol )(implicit ctx : Context ): Boolean =
14791484 sym.isTerm && sym.is(Flags .Method ) && ! sym.isConstructor
14801485
1481- def ClassSymbol_caseFields (self : Symbol )(implicit ctx : Context ): List [ValSymbol ] = {
1486+ def ClassDefSymbol_caseFields (self : Symbol )(implicit ctx : Context ): List [ValDefSymbol ] = {
14821487 if (! self.isClass) Nil
14831488 else self.asClass.paramAccessors.collect {
14841489 case sym if sym.is(Flags .CaseAccessor ) => sym.asTerm
14851490 }
14861491 }
14871492
1488- def ClassSymbol_companionClass (self : Symbol )(implicit ctx : Context ): Option [ClassSymbol ] = {
1493+ def ClassDefSymbol_companionClass (self : Symbol )(implicit ctx : Context ): Option [ClassDefSymbol ] = {
14891494 val sym = self.companionModule.companionClass
14901495 if (sym.exists) Some (sym.asClass) else None
14911496 }
14921497
1493- def ClassSymbol_companionModule (self : Symbol )(implicit ctx : Context ): Option [ValSymbol ] = {
1498+ def ClassDefSymbol_companionModule (self : Symbol )(implicit ctx : Context ): Option [ValDefSymbol ] = {
14941499 val sym = self.companionModule
14951500 if (sym.exists) Some (sym.asTerm) else None
14961501 }
14971502
1498- def ClassSymbol_moduleClass (self : Symbol )(implicit ctx : Context ): Option [Symbol ] = {
1503+ def ClassDefSymbol_moduleClass (self : Symbol )(implicit ctx : Context ): Option [Symbol ] = {
14991504 val sym = self.moduleClass
15001505 if (sym.exists) Some (sym.asTerm) else None
15011506 }
15021507
15031508 private def isField (sym : Symbol )(implicit ctx : Context ): Boolean = sym.isTerm && ! sym.is(Flags .Method )
15041509
1505- def ClassSymbol_of (fullName : String )(implicit ctx : Context ): ClassSymbol = ctx.requiredClass(fullName)
1510+ def ClassDefSymbol_of (fullName : String )(implicit ctx : Context ): ClassDefSymbol = ctx.requiredClass(fullName)
15061511
1507- type TypeSymbol = core.Symbols .TypeSymbol
1512+ type TypeDefSymbol = core.Symbols .TypeSymbol
15081513
1509- def matchTypeSymbol (symbol : Symbol )(implicit ctx : Context ): Option [TypeSymbol ] =
1514+ def matchTypeDefSymbol (symbol : Symbol )(implicit ctx : Context ): Option [TypeDefSymbol ] =
15101515 if (symbol.isType) Some (symbol.asType) else None
15111516
1512- def TypeSymbol_tree (self : TypeSymbol )(implicit ctx : Context ): TypeDef =
1517+ def TypeDefSymbol_tree (self : TypeDefSymbol )(implicit ctx : Context ): TypeDef =
15131518 FromSymbol .typeDefFromSym(self)
1514- def TypeSymbol_isTypeParam (self : TypeSymbol )(implicit ctx : Context ): Boolean =
1519+ def TypeDefSymbol_isTypeParam (self : TypeDefSymbol )(implicit ctx : Context ): Boolean =
15151520 self.isTypeParam
15161521
1517- type DefSymbol = core.Symbols .TermSymbol
1522+ type TypeBindSymbol = core.Symbols .TypeSymbol
1523+
1524+ def matchTypeBindSymbol (symbol : Symbol )(implicit ctx : Context ): Option [TypeBindSymbol ] =
1525+ if (symbol.isType && symbol.is(core.Flags .Case )) Some (symbol.asType) else None
1526+
1527+ def TypeBindSymbol_tree (self : TypeBindSymbol )(implicit ctx : Context ): TypeTree_TypeBind =
1528+ FromSymbol .typeBindFromSym(self)
1529+
1530+ type TermSymbol = core.Symbols .TermSymbol
1531+
1532+ def matchTermSymbol (symbol : Symbol )(implicit ctx : Context ): Option [TermSymbol ] =
1533+ if (symbol.isTerm) Some (symbol.asTerm) else None
1534+
1535+ type DefDefSymbol = core.Symbols .TermSymbol
15181536
1519- def matchDefSymbol (symbol : Symbol )(implicit ctx : Context ): Option [DefSymbol ] =
1537+ def matchDefDefSymbol (symbol : Symbol )(implicit ctx : Context ): Option [DefDefSymbol ] =
15201538 if (symbol.isTerm && symbol.is(core.Flags .Method )) Some (symbol.asTerm) else None
15211539
1522- def DefSymbol_tree (self : DefSymbol )(implicit ctx : Context ): DefDef =
1540+ def DefDefSymbol_tree (self : DefDefSymbol )(implicit ctx : Context ): DefDef =
15231541 FromSymbol .defDefFromSym(self)
15241542
1525- def DefSymbol_signature (self : DefSymbol )(implicit ctx : Context ): Signature =
1543+ def DefDefSymbol_signature (self : DefDefSymbol )(implicit ctx : Context ): Signature =
15261544 self.signature
15271545
1528- type ValSymbol = core.Symbols .TermSymbol
1546+ type ValDefSymbol = core.Symbols .TermSymbol
15291547
1530- def matchValSymbol (symbol : Symbol )(implicit ctx : Context ): Option [ValSymbol ] =
1548+ def matchValDefSymbol (symbol : Symbol )(implicit ctx : Context ): Option [ValDefSymbol ] =
15311549 if (symbol.isTerm && ! symbol.is(core.Flags .Method ) && ! symbol.is(core.Flags .Case )) Some (symbol.asTerm) else None
15321550
1533- def ValSymbol_tree (self : ValSymbol )(implicit ctx : Context ): ValDef =
1551+ def ValDefSymbol_tree (self : ValDefSymbol )(implicit ctx : Context ): ValDef =
15341552 FromSymbol .valDefFromSym(self)
15351553
1536- def ValSymbol_moduleClass (self : ValSymbol )(implicit ctx : Context ): Option [ClassSymbol ] = {
1554+ def ValDefSymbol_moduleClass (self : ValDefSymbol )(implicit ctx : Context ): Option [ClassDefSymbol ] = {
15371555 val sym = self.moduleClass
15381556 if (sym.exists) Some (sym.asClass) else None
15391557 }
15401558
1541- def ValSymbol_companionClass (self : ValSymbol )(implicit ctx : Context ): Option [ClassSymbol ] = {
1559+ def ValDefSymbol_companionClass (self : ValDefSymbol )(implicit ctx : Context ): Option [ClassDefSymbol ] = {
15421560 val sym = self.companionClass
15431561 if (sym.exists) Some (sym.asClass) else None
15441562 }
0 commit comments