aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/core
diff options
context:
space:
mode:
authorGuillaume Martres <smarter@ubuntu.com>2016-12-21 22:40:36 +0100
committerGitHub <noreply@github.com>2016-12-21 22:40:36 +0100
commit404ce763d0f9ef82dae52e6aff3ec20950c67e29 (patch)
treee1c1b4ac13d26c214816b2f0582e573298c741f4 /compiler/src/dotty/tools/dotc/core
parentee4f4a109b3ec3190886c75bb6d140087c33287d (diff)
parent9568eba6de7e881c6003dbfc95e46e6f83fa2e7b (diff)
downloaddotty-404ce763d0f9ef82dae52e6aff3ec20950c67e29.tar.gz
dotty-404ce763d0f9ef82dae52e6aff3ec20950c67e29.tar.bz2
dotty-404ce763d0f9ef82dae52e6aff3ec20950c67e29.zip
Merge pull request #1826 from dotty-staging/fix-compile-stdlib
Make more parts of stdlib compile
Diffstat (limited to 'compiler/src/dotty/tools/dotc/core')
-rw-r--r--compiler/src/dotty/tools/dotc/core/TypeComparer.scala10
-rw-r--r--compiler/src/dotty/tools/dotc/core/TypeOps.scala2
-rw-r--r--compiler/src/dotty/tools/dotc/core/Types.scala8
3 files changed, 17 insertions, 3 deletions
diff --git a/compiler/src/dotty/tools/dotc/core/TypeComparer.scala b/compiler/src/dotty/tools/dotc/core/TypeComparer.scala
index 334306f19..8930983f3 100644
--- a/compiler/src/dotty/tools/dotc/core/TypeComparer.scala
+++ b/compiler/src/dotty/tools/dotc/core/TypeComparer.scala
@@ -757,8 +757,14 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
if (args1.isEmpty) args2.isEmpty
else args2.nonEmpty && {
val v = tparams.head.paramVariance
- (v > 0 || isSubType(args2.head, args1.head)) &&
- (v < 0 || isSubType(args1.head, args2.head))
+ def isSub(tp1: Type, tp2: Type) = tp2 match {
+ case tp2: TypeBounds =>
+ tp2.contains(tp1)
+ case _ =>
+ (v > 0 || isSubType(tp2, tp1)) &&
+ (v < 0 || isSubType(tp1, tp2))
+ }
+ isSub(args1.head, args2.head)
} && isSubArgs(args1.tail, args2.tail, tparams)
/** Test whether `tp1` has a base type of the form `B[T1, ..., Tn]` where
diff --git a/compiler/src/dotty/tools/dotc/core/TypeOps.scala b/compiler/src/dotty/tools/dotc/core/TypeOps.scala
index db73daaa2..c2a7d7ea6 100644
--- a/compiler/src/dotty/tools/dotc/core/TypeOps.scala
+++ b/compiler/src/dotty/tools/dotc/core/TypeOps.scala
@@ -552,7 +552,7 @@ trait TypeOps { this: Context => // TODO: Make standalone object.
def dynamicsEnabled =
featureEnabled(defn.LanguageModuleClass, nme.dynamics)
- def testScala2Mode(msg: String, pos: Position) = {
+ def testScala2Mode(msg: => String, pos: Position) = {
if (scala2Mode) migrationWarning(msg, pos)
scala2Mode
}
diff --git a/compiler/src/dotty/tools/dotc/core/Types.scala b/compiler/src/dotty/tools/dotc/core/Types.scala
index 64fa48071..636204f64 100644
--- a/compiler/src/dotty/tools/dotc/core/Types.scala
+++ b/compiler/src/dotty/tools/dotc/core/Types.scala
@@ -217,6 +217,14 @@ object Types {
case _ => false
}
+ /** Is this the type of a method with a leading empty parameter list?
+ */
+ def isNullaryMethod(implicit ctx: Context): Boolean = this match {
+ case MethodType(Nil, _) => true
+ case tp: PolyType => tp.resultType.isNullaryMethod
+ case _ => false
+ }
+
/** Is this an alias TypeBounds? */
def isAlias: Boolean = this.isInstanceOf[TypeAlias]