Skip to content

Commit b38b932

Browse files
committed
Rename NameOps.likeSpaced to prevent confusion
1 parent 0176d1a commit b38b932

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

compiler/src/dotty/tools/dotc/core/NameOps.scala

+14-14
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ object NameOps {
5858
case _ => false
5959
}
6060

61-
private def likeSpaced(n: PreName): N =
61+
private def likeSpacedN(n: PreName): N =
6262
name.likeSpaced(n).asInstanceOf[N]
6363

6464
def isConstructorName = name == CONSTRUCTOR || name == TRAIT_CONSTRUCTOR
@@ -100,7 +100,7 @@ object NameOps {
100100
* method needs to work on mangled as well as unmangled names because
101101
* it is also called from the backend.
102102
*/
103-
def stripModuleClassSuffix: N = likeSpaced {
103+
def stripModuleClassSuffix: N = likeSpacedN {
104104
val semName = name.toTermName match {
105105
case name: SimpleName if name.endsWith("$") => name.unmangleClassName
106106
case _ => name
@@ -109,7 +109,7 @@ object NameOps {
109109
}
110110

111111
/** If flags is a ModuleClass but not a Package, add module class suffix */
112-
def adjustIfModuleClass(flags: Flags.FlagSet): N = likeSpaced {
112+
def adjustIfModuleClass(flags: Flags.FlagSet): N = likeSpacedN {
113113
if (flags is (ModuleClass, butNot = Package)) name.asTypeName.moduleClassName
114114
else name.toTermName.exclude(AvoidClashName)
115115
}
@@ -119,27 +119,27 @@ object NameOps {
119119
* followed by `kind` and the name.
120120
*/
121121
def expandedName(base: Symbol, kind: QualifiedNameKind = ExpandedName)(implicit ctx: Context): N =
122-
likeSpaced { base.fullNameSeparated(ExpandPrefixName, kind, name) }
122+
likeSpacedN { base.fullNameSeparated(ExpandPrefixName, kind, name) }
123123

124124
/** Revert the expanded name. */
125-
def unexpandedName: N = likeSpaced {
125+
def unexpandedName: N = likeSpacedN {
126126
name.rewrite { case ExpandedName(_, unexp) => unexp }
127127
}
128128

129129
/** Remove the variance from the name. */
130-
def invariantName: N = likeSpaced {
130+
def invariantName: N = likeSpacedN {
131131
name.rewrite { case VariantName(invariant, _) => invariant }
132132
}
133133

134-
def implClassName: N = likeSpaced(name ++ tpnme.IMPL_CLASS_SUFFIX)
134+
def implClassName: N = likeSpacedN(name ++ tpnme.IMPL_CLASS_SUFFIX)
135135

136136
def traitOfImplClassName: N = {
137137
val suffix = tpnme.IMPL_CLASS_SUFFIX.toString
138138
assert(name.endsWith(suffix), name)
139-
likeSpaced(name.mapLast(_.dropRight(suffix.length)))
139+
likeSpacedN(name.mapLast(_.dropRight(suffix.length)))
140140
}
141141

142-
def errorName: N = likeSpaced(name ++ nme.ERROR)
142+
def errorName: N = likeSpacedN(name ++ nme.ERROR)
143143

144144
/** Map variance value -1, +1 to 0, 1 */
145145
private def varianceToNat(v: Int) = (v + 1) / 2
@@ -150,7 +150,7 @@ object NameOps {
150150
/** Name with variance prefix: `+` for covariant, `-` for contravariant */
151151
def withVariance(v: Int): N = {
152152
val underlying = name.exclude(VariantName)
153-
likeSpaced(
153+
likeSpacedN(
154154
if (v == 0) underlying
155155
else VariantName(underlying.toTermName, varianceToNat(v)))
156156
}
@@ -160,7 +160,7 @@ object NameOps {
160160
*/
161161
def variance = name.collect { case VariantName(_, n) => natToVariance(n) }.getOrElse(0)
162162

163-
def freshened(implicit ctx: Context): N = likeSpaced {
163+
def freshened(implicit ctx: Context): N = likeSpacedN {
164164
name.toTermName match {
165165
case ModuleClassName(original) => ModuleClassName(original.freshened)
166166
case name => UniqueName.fresh(name)
@@ -238,7 +238,7 @@ object NameOps {
238238
val methodTags: Seq[Name] = (methodTargs zip methodTarsNames).sortBy(_._2).map(x => defn.typeTag(x._1))
239239
val classTags: Seq[Name] = (classTargs zip classTargsNames).sortBy(_._2).map(x => defn.typeTag(x._1))
240240

241-
likeSpaced(name ++ nme.specializedTypeNames.prefix ++
241+
likeSpacedN(name ++ nme.specializedTypeNames.prefix ++
242242
methodTags.fold(nme.EMPTY)(_ ++ _) ++ nme.specializedTypeNames.separator ++
243243
classTags.fold(nme.EMPTY)(_ ++ _) ++ nme.specializedTypeNames.suffix)
244244
}
@@ -249,11 +249,11 @@ object NameOps {
249249
def unmangleClassName: N = name.toTermName match {
250250
case name: SimpleName
251251
if name.endsWith(str.MODULE_SUFFIX) && !nme.falseModuleClassNames.contains(name) =>
252-
likeSpaced(name.dropRight(str.MODULE_SUFFIX.length).moduleClassName)
252+
likeSpacedN(name.dropRight(str.MODULE_SUFFIX.length).moduleClassName)
253253
case _ => name
254254
}
255255

256-
def unmangle(kind: NameKind): N = likeSpaced {
256+
def unmangle(kind: NameKind): N = likeSpacedN {
257257
name rewrite {
258258
case unmangled: SimpleName =>
259259
kind.unmangle(unmangled)

0 commit comments

Comments
 (0)