aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/NameOps.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-06-12 14:50:05 +0200
committerMartin Odersky <odersky@gmail.com>2014-06-12 15:35:57 +0200
commit96196c9ffa9939acd7437103d1621dac96e9abc6 (patch)
treeca87d4f694e47e453ad4d791cff80adb4cf3bbe4 /src/dotty/tools/dotc/core/NameOps.scala
parent51563aee5478f90a0f86c29385f74d020b8995dd (diff)
downloaddotty-96196c9ffa9939acd7437103d1621dac96e9abc6.tar.gz
dotty-96196c9ffa9939acd7437103d1621dac96e9abc6.tar.bz2
dotty-96196c9ffa9939acd7437103d1621dac96e9abc6.zip
Names and definitions for Lambdas
Adding names and definitions for the Lambda scheme to hk types. Also add HigherKinded flag for HK type parameters and abstract types.
Diffstat (limited to 'src/dotty/tools/dotc/core/NameOps.scala')
-rw-r--r--src/dotty/tools/dotc/core/NameOps.scala12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/dotty/tools/dotc/core/NameOps.scala b/src/dotty/tools/dotc/core/NameOps.scala
index 22a7e5734..187946590 100644
--- a/src/dotty/tools/dotc/core/NameOps.scala
+++ b/src/dotty/tools/dotc/core/NameOps.scala
@@ -87,13 +87,15 @@ object NameOps {
name.last == '=' && name.head != '=' && isOperatorPart(name.head)
}
- /** Is this the name of a higher-kinded type parameter? */
- def isHkParamName: Boolean = name(0) == '_' && name.startsWith(HK_PARAM_PREFIX)
+ /** 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
/** The index of the higher-kinded type parameter with this name.
- * Pre: isHkParamName.
+ * Pre: isLambdaArgName.
*/
- def hkParamIndex: Int = name.drop(name.lastIndexOf('$') + 1).toString.toInt
+ 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.
@@ -181,7 +183,7 @@ object NameOps {
* by this name.
* @pre The name is a higher-kinded trait name, i.e. it starts with HK_TRAIT_PREFIX
*/
- def hkVariances: List[Int] = {
+ def hkVariances: List[Int] = { // tbr
def varianceOfSuffix(suffix: Char): Int = {
val idx = tpnme.varianceSuffixes.indexOf(suffix)
assert(idx >= 0)