Skip to content

Commit e1ec747

Browse files
committed
Fix rebase breakage
1 parent 476123e commit e1ec747

File tree

4 files changed

+6
-22
lines changed

4 files changed

+6
-22
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ object Flags {
452452
final val FromStartFlags =
453453
Module | Package | Deferred | MethodOrHKCommon | Param | ParamAccessor |
454454
Scala2ExistentialCommon | Mutable.toCommonFlags | InSuperCall | Touched | JavaStatic |
455-
CovariantOrOuter | ContravariantOrLabel | ExpandedName | CaseAccessorOrBaseTypeArg |
455+
CovariantOrOuter | ContravariantOrLabel | CaseAccessorOrBaseTypeArg |
456456
Fresh | Frozen | Erroneous | ImplicitCommon | Permanent | Synthetic |
457457
SuperAccessorOrScala2x | Inline
458458

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

-1
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,6 @@ object NameKinds {
252252

253253
object VariantName extends NumberedNameKind(VARIANT, "Variant") {
254254
val varianceToPrefix = Map(-1 -> '-', 0 -> '=', 1 -> '+')
255-
val prefixToVariance = Map('-' -> -1, '=' -> 0, '+' -> 1)
256255
def mkString(underlying: TermName, info: ThisInfo) = {
257256
varianceToPrefix(info.num).toString + underlying
258257
}

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

+3-20
Original file line numberDiff line numberDiff line change
@@ -126,33 +126,16 @@ object NameOps {
126126

127127
def errorName: N = likeSpaced(name ++ nme.ERROR)
128128

129-
/*
129+
130130
/** Name with variance prefix: `+` for covariant, `-` for contravariant */
131131
def withVariance(v: Int): N =
132-
if (hasVariance) dropVariance.withVariance(v)
133-
else v match {
134-
case -1 => likeTyped('-' +: name)
135-
case 1 => likeTyped('+' +: name)
136-
case 0 => name
137-
}
138-
139-
/** Does name have a `+`/`-` variance prefix? */
140-
def hasVariance: Boolean =
141-
name.nonEmpty && name.head == '+' || name.head == '-'
142-
143-
/** Drop variance prefix if name has one */
144-
def dropVariance: N = if (hasVariance) likeTyped(name.tail) else name
132+
likeSpaced { VariantName(name.exclude(VariantName).toTermName, v) }
145133

146134
/** The variance as implied by the variance prefix, or 0 if there is
147135
* no variance prefix.
148136
*/
149-
def variance = name.head match {
150-
case '-' => -1
151-
case '+' => 1
152-
case _ => 0
153-
}
137+
def variance = name.collect { case VariantName(_, n) => n }.getOrElse(0)
154138

155-
*/
156139
def freshened(implicit ctx: Context): N = likeSpaced {
157140
name.toTermName match {
158141
case ModuleClassName(original) => ModuleClassName(original.freshened)

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

+2
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ object StdNames {
122122
val DEFAULT_GETTER: N = str.DEFAULT_GETTER
123123
val DEFAULT_GETTER_INIT: N = "$lessinit$greater"
124124
val DO_WHILE_PREFIX: N = "doWhile$"
125+
val DOLLAR_VALUES: N = "$values"
126+
val DOLLAR_NEW: N = "$new"
125127
val EMPTY: N = ""
126128
val EMPTY_PACKAGE: N = Names.EMPTY_PACKAGE.toString
127129
val EXCEPTION_RESULT_PREFIX: N = "exceptionResult"

0 commit comments

Comments
 (0)