aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/dotty/tools/dotc/core')
-rw-r--r--src/dotty/tools/dotc/core/NameOps.scala7
-rw-r--r--src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala2
2 files changed, 8 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/core/NameOps.scala b/src/dotty/tools/dotc/core/NameOps.scala
index 81240a9fc..b3b0982a4 100644
--- a/src/dotty/tools/dotc/core/NameOps.scala
+++ b/src/dotty/tools/dotc/core/NameOps.scala
@@ -116,7 +116,12 @@ object NameOps {
name.drop(tpnme.hkArgPrefixLength).toString.toInt
def isLambdaTraitName(implicit ctx: Context): Boolean =
- name.startsWith(tpnme.hkLambdaPrefix)
+ name.isTypeName && name.startsWith(tpnme.hkLambdaPrefix)
+
+ def lambdaTraitVariances(implicit ctx: Context): List[Int] = {
+ val vs = name.drop(tpnme.hkLambdaPrefix.length)
+ vs.map(c => tpnme.varianceSuffixes.indexOf(c) - 1).toList
+ }
/** If the name ends with $nn where nn are
* all digits, strip the $ and the digits.
diff --git a/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala b/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala
index b547862b4..3a9803346 100644
--- a/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala
+++ b/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala
@@ -252,6 +252,8 @@ class TreeUnpickler(reader: TastyReader, tastyName: TastyName.Table) {
readPackageRef().termRef
case TYPEREF =>
val name = readName().toTypeName
+ if (name.isLambdaTraitName) // Make sure curresponding lambda trait exists
+ defn.LambdaTrait(name.lambdaTraitVariances)
TypeRef(readType(), name)
case TERMREF =>
readNameSplitSig() match {