File tree 4 files changed +6
-22
lines changed
compiler/src/dotty/tools/dotc/core
4 files changed +6
-22
lines changed Original file line number Diff line number Diff line change @@ -452,7 +452,7 @@ object Flags {
452
452
final val FromStartFlags =
453
453
Module | Package | Deferred | MethodOrHKCommon | Param | ParamAccessor |
454
454
Scala2ExistentialCommon | Mutable .toCommonFlags | InSuperCall | Touched | JavaStatic |
455
- CovariantOrOuter | ContravariantOrLabel | ExpandedName | CaseAccessorOrBaseTypeArg |
455
+ CovariantOrOuter | ContravariantOrLabel | CaseAccessorOrBaseTypeArg |
456
456
Fresh | Frozen | Erroneous | ImplicitCommon | Permanent | Synthetic |
457
457
SuperAccessorOrScala2x | Inline
458
458
Original file line number Diff line number Diff line change @@ -252,7 +252,6 @@ object NameKinds {
252
252
253
253
object VariantName extends NumberedNameKind (VARIANT , " Variant" ) {
254
254
val varianceToPrefix = Map (- 1 -> '-' , 0 -> '=' , 1 -> '+' )
255
- val prefixToVariance = Map ('-' -> - 1 , '=' -> 0 , '+' -> 1 )
256
255
def mkString (underlying : TermName , info : ThisInfo ) = {
257
256
varianceToPrefix(info.num).toString + underlying
258
257
}
Original file line number Diff line number Diff line change @@ -126,33 +126,16 @@ object NameOps {
126
126
127
127
def errorName : N = likeSpaced(name ++ nme.ERROR )
128
128
129
- /*
129
+
130
130
/** Name with variance prefix: `+` for covariant, `-` for contravariant */
131
131
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) }
145
133
146
134
/** The variance as implied by the variance prefix, or 0 if there is
147
135
* no variance prefix.
148
136
*/
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 )
154
138
155
- */
156
139
def freshened (implicit ctx : Context ): N = likeSpaced {
157
140
name.toTermName match {
158
141
case ModuleClassName (original) => ModuleClassName (original.freshened)
Original file line number Diff line number Diff line change @@ -122,6 +122,8 @@ object StdNames {
122
122
val DEFAULT_GETTER : N = str.DEFAULT_GETTER
123
123
val DEFAULT_GETTER_INIT : N = " $lessinit$greater"
124
124
val DO_WHILE_PREFIX : N = " doWhile$"
125
+ val DOLLAR_VALUES : N = " $values"
126
+ val DOLLAR_NEW : N = " $new"
125
127
val EMPTY : N = " "
126
128
val EMPTY_PACKAGE : N = Names .EMPTY_PACKAGE .toString
127
129
val EXCEPTION_RESULT_PREFIX : N = " exceptionResult"
You can’t perform that action at this time.
0 commit comments