diff options
author | Martin Odersky <odersky@gmail.com> | 2017-04-06 14:58:20 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2017-04-11 09:33:12 +0200 |
commit | b17af4b7abfa1de2a0099329a7e7148cabafbab0 (patch) | |
tree | 6fc3a2cae920fbf619a4556f829c4b713a5f66ca /compiler/src/dotty/tools/dotc/core/NameOps.scala | |
parent | 868a6a1025781eeac3eb884040639119542b3f49 (diff) | |
download | dotty-b17af4b7abfa1de2a0099329a7e7148cabafbab0.tar.gz dotty-b17af4b7abfa1de2a0099329a7e7148cabafbab0.tar.bz2 dotty-b17af4b7abfa1de2a0099329a7e7148cabafbab0.zip |
Fix rebase breakage
Diffstat (limited to 'compiler/src/dotty/tools/dotc/core/NameOps.scala')
-rw-r--r-- | compiler/src/dotty/tools/dotc/core/NameOps.scala | 23 |
1 files changed, 3 insertions, 20 deletions
diff --git a/compiler/src/dotty/tools/dotc/core/NameOps.scala b/compiler/src/dotty/tools/dotc/core/NameOps.scala index 27bd3a05e..915bd52ab 100644 --- a/compiler/src/dotty/tools/dotc/core/NameOps.scala +++ b/compiler/src/dotty/tools/dotc/core/NameOps.scala @@ -126,33 +126,16 @@ object NameOps { def errorName: N = likeSpaced(name ++ nme.ERROR) -/* + /** Name with variance prefix: `+` for covariant, `-` for contravariant */ def withVariance(v: Int): N = - if (hasVariance) dropVariance.withVariance(v) - else v match { - case -1 => likeTyped('-' +: name) - case 1 => likeTyped('+' +: name) - case 0 => name - } - - /** Does name have a `+`/`-` variance prefix? */ - def hasVariance: Boolean = - name.nonEmpty && name.head == '+' || name.head == '-' - - /** Drop variance prefix if name has one */ - def dropVariance: N = if (hasVariance) likeTyped(name.tail) else name + likeSpaced { VariantName(name.exclude(VariantName).toTermName, v) } /** The variance as implied by the variance prefix, or 0 if there is * no variance prefix. */ - def variance = name.head match { - case '-' => -1 - case '+' => 1 - case _ => 0 - } + def variance = name.collect { case VariantName(_, n) => n }.getOrElse(0) -*/ def freshened(implicit ctx: Context): N = likeSpaced { name.toTermName match { case ModuleClassName(original) => ModuleClassName(original.freshened) |