diff options
author | Martin Odersky <odersky@gmail.com> | 2014-06-18 18:20:14 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-06-18 18:21:07 +0200 |
commit | 7f721438b5bccc8ca9dd68cef273c8cac8199e1a (patch) | |
tree | a619fb770fee578354c7fca1f1c30c68f0d542d0 /src/dotty/tools/dotc/core/NameOps.scala | |
parent | 388d9a889c6929699e879a307dc80145b906390a (diff) | |
download | dotty-7f721438b5bccc8ca9dd68cef273c8cac8199e1a.tar.gz dotty-7f721438b5bccc8ca9dd68cef273c8cac8199e1a.tar.bz2 dotty-7f721438b5bccc8ca9dd68cef273c8cac8199e1a.zip |
Handling higher-kinded types with lambdas
Switch to the new scheme where higher-kinded types (and also some polymorphic
type aliases) are represented as instances of Lambda traits.
Diffstat (limited to 'src/dotty/tools/dotc/core/NameOps.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/NameOps.scala | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/src/dotty/tools/dotc/core/NameOps.scala b/src/dotty/tools/dotc/core/NameOps.scala index 187946590..55354cc17 100644 --- a/src/dotty/tools/dotc/core/NameOps.scala +++ b/src/dotty/tools/dotc/core/NameOps.scala @@ -88,14 +88,13 @@ object NameOps { } /** Is this the name of a higher-kinded type parameter of a Lambda? */ - def isLambdaArgName = name.startsWith(tpnme.LAMBDA_ARG_PREFIX) - def isHkParamName: Boolean = name(0) == '_' && name.startsWith(HK_PARAM_PREFIX) // tbr + def isLambdaArgName = + name(0) == tpnme.LAMBDA_ARG_PREFIXhead && name.startsWith(tpnme.LAMBDA_ARG_PREFIX) /** The index of the higher-kinded type parameter with this name. * Pre: isLambdaArgName. */ def lambdaArgIndex: Int = name.drop(name.lastIndexOf('$') + 1).toString.toInt - def hkParamIndex: Int = name.drop(name.lastIndexOf('$') + 1).toString.toInt // tbr /** If the name ends with $nn where nn are * all digits, strip the $ and the digits. @@ -179,19 +178,6 @@ object NameOps { } } - /** The variances of the higherKinded parameters of the trait named - * by this name. - * @pre The name is a higher-kinded trait name, i.e. it starts with HK_TRAIT_PREFIX - */ - def hkVariances: List[Int] = { // tbr - def varianceOfSuffix(suffix: Char): Int = { - val idx = tpnme.varianceSuffixes.indexOf(suffix) - assert(idx >= 0) - idx - 1 - } - name.drop(tpnme.HK_TRAIT_PREFIX.length).toList.map(varianceOfSuffix) - } - /** The name of the generic runtime operation corresponding to an array operation */ def genericArrayOp: TermName = name match { case nme.apply => nme.array_apply |