File tree Expand file tree Collapse file tree 4 files changed +6
-22
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 4 files changed +6
-22
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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 }
Original file line number Diff line number Diff 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)
Original file line number Diff line number Diff 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"
You can’t perform that action at this time.
0 commit comments