@@ -74,11 +74,8 @@ object desugar {
7474 def derivedTree (sym : Symbol )(implicit ctx : Context ): tpd.Tree = tpd.ref(sym)
7575 }
7676
77- /** A type tree that computes its type from an existing parameter.
78- * @param suffix String difference between existing parameter (call it `P`) and parameter owning the
79- * DerivedTypeTree (call it `O`). We have: `O.name == P.name + suffix`.
80- */
81- class DerivedFromParamTree (suffix : String )(implicit @ constructorOnly src : SourceFile ) extends DerivedTypeTree {
77+ /** A type tree that computes its type from an existing parameter. */
78+ class DerivedFromParamTree (implicit @ constructorOnly src : SourceFile ) extends DerivedTypeTree {
8279
8380 /** Make sure that for all enclosing module classes their companion classes
8481 * are completed. Reason: We need the constructor of such companion classes to
@@ -96,24 +93,20 @@ object desugar {
9693
9794 /** Return info of original symbol, where all references to siblings of the
9895 * original symbol (i.e. sibling and original symbol have the same owner)
99- * are rewired to like -named* parameters or accessors in the scope enclosing
96+ * are rewired to same -named parameters or accessors in the scope enclosing
10097 * the current scope. The current scope is the scope owned by the defined symbol
10198 * itself, that's why we have to look one scope further out. If the resulting
10299 * type is an alias type, dealias it. This is necessary because the
103100 * accessor of a type parameter is a private type alias that cannot be accessed
104101 * from subclasses.
105- *
106- * (*) like-named means:
107- *
108- * parameter name == reference name ++ suffix
109102 */
110103 def derivedTree (sym : Symbol )(implicit ctx : Context ): tpd.TypeTree = {
111104 val relocate = new TypeMap {
112105 val originalOwner = sym.owner
113106 def apply (tp : Type ) = tp match {
114107 case tp : NamedType if tp.symbol.exists && (tp.symbol.owner eq originalOwner) =>
115108 val defctx = ctx.outersIterator.dropWhile(_.scope eq ctx.scope).next()
116- var local = defctx.denotNamed(tp.name ++ suffix ).suchThat(_.isParamOrAccessor).symbol
109+ var local = defctx.denotNamed(tp.name).suchThat(_.isParamOrAccessor).symbol
117110 if (local.exists) (defctx.owner.thisType select local).dealiasKeepAnnots
118111 else {
119112 def msg =
@@ -129,20 +122,19 @@ object desugar {
129122 }
130123
131124 /** A type definition copied from `tdef` with a rhs typetree derived from it */
132- def derivedTypeParam (tdef : TypeDef , suffix : String = " " )(implicit ctx : Context ): TypeDef =
125+ def derivedTypeParam (tdef : TypeDef )(implicit ctx : Context ): TypeDef =
133126 cpy.TypeDef (tdef)(
134- name = tdef.name ++ suffix,
135- rhs = DerivedFromParamTree (suffix).withSpan(tdef.rhs.span).watching(tdef)
127+ rhs = DerivedFromParamTree ().withSpan(tdef.rhs.span).watching(tdef)
136128 )
137129
138130 /** A derived type definition watching `sym` */
139131 def derivedTypeParam (sym : TypeSymbol )(implicit ctx : Context ): TypeDef =
140- TypeDef (sym.name, DerivedFromParamTree (" " ).watching(sym)).withFlags(TypeParam )
132+ TypeDef (sym.name, DerivedFromParamTree ().watching(sym)).withFlags(TypeParam )
141133
142134 /** A value definition copied from `vdef` with a tpt typetree derived from it */
143135 def derivedTermParam (vdef : ValDef )(implicit ctx : Context ): ValDef =
144136 cpy.ValDef (vdef)(
145- tpt = DerivedFromParamTree (" " ).withSpan(vdef.tpt.span).watching(vdef))
137+ tpt = DerivedFromParamTree ().withSpan(vdef.tpt.span).watching(vdef))
146138
147139// ----- Desugar methods -------------------------------------------------
148140
0 commit comments