aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Definitions.scala
diff options
context:
space:
mode:
authorGuillaume Martres <smarter@ubuntu.com>2015-12-01 16:52:01 +0100
committerGuillaume Martres <smarter@ubuntu.com>2015-12-01 17:11:28 +0100
commit60fb657649d800c03e8335892cd82455e7e34235 (patch)
tree00a90ea37bd3031884aecbe3834a98a59b826c2e /src/dotty/tools/dotc/core/Definitions.scala
parent112564655f4f23552cb9ae48d0fdb7d8ac5b725c (diff)
downloaddotty-60fb657649d800c03e8335892cd82455e7e34235.tar.gz
dotty-60fb657649d800c03e8335892cd82455e7e34235.tar.bz2
dotty-60fb657649d800c03e8335892cd82455e7e34235.zip
Compile scala.collection.Seq without double-binding error
This commit fixes two issues which caused us to complete Seq too early and read it from the classpath instead of from the sources: - Evaluting RepeatedParamClass forced Seq, this is not necessary because the type of RepeatedParamClass is a LazyType - TypeErasure#sigName on a Scala type always forced Seq, even if the type is not a repeated param type. This fixes #980.
Diffstat (limited to 'src/dotty/tools/dotc/core/Definitions.scala')
-rw-r--r--src/dotty/tools/dotc/core/Definitions.scala11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/dotty/tools/dotc/core/Definitions.scala b/src/dotty/tools/dotc/core/Definitions.scala
index 433b8544a..4556dd9d5 100644
--- a/src/dotty/tools/dotc/core/Definitions.scala
+++ b/src/dotty/tools/dotc/core/Definitions.scala
@@ -56,7 +56,10 @@ class Definitions {
private def newSyntheticTypeParam(cls: ClassSymbol, scope: MutableScope, paramFlags: FlagSet, suffix: String = "T0") =
newTypeParam(cls, suffix.toTypeName.expandedName(cls), ExpandedName | paramFlags, scope)
- private def specialPolyClass(name: TypeName, paramFlags: FlagSet, parentConstrs: Type*): ClassSymbol = {
+ // NOTE: Ideally we would write `parentConstrs: => Type*` but SIP-24 is only
+ // implemented in Dotty and not in Scala 2.
+ // See <http://docs.scala-lang.org/sips/pending/repeated-byname.html>.
+ private def specialPolyClass(name: TypeName, paramFlags: FlagSet, parentConstrs: => Seq[Type]): ClassSymbol = {
val completer = new LazyType {
def complete(denot: SymDenotation)(implicit ctx: Context): Unit = {
val cls = denot.asClass.classSymbol
@@ -353,10 +356,10 @@ class Definitions {
lazy val BoxedDoubleModule = ctx.requiredModule("java.lang.Double")
lazy val BoxedUnitModule = ctx.requiredModule("java.lang.Void")
- lazy val ByNameParamClass2x = specialPolyClass(tpnme.BYNAME_PARAM_CLASS, Covariant, AnyType)
- lazy val EqualsPatternClass = specialPolyClass(tpnme.EQUALS_PATTERN, EmptyFlags, AnyType)
+ lazy val ByNameParamClass2x = specialPolyClass(tpnme.BYNAME_PARAM_CLASS, Covariant, Seq(AnyType))
+ lazy val EqualsPatternClass = specialPolyClass(tpnme.EQUALS_PATTERN, EmptyFlags, Seq(AnyType))
- lazy val RepeatedParamClass = specialPolyClass(tpnme.REPEATED_PARAM_CLASS, Covariant, ObjectType, SeqType)
+ lazy val RepeatedParamClass = specialPolyClass(tpnme.REPEATED_PARAM_CLASS, Covariant, Seq(ObjectType, SeqType))
// fundamental classes
lazy val StringClass = ctx.requiredClass("java.lang.String")