summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbuild.xml5
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Implicits.scala31
-rw-r--r--src/eclipse/partest/.classpath2
-rw-r--r--src/eclipse/scaladoc/.classpath6
-rw-r--r--src/library/scala/concurrent/impl/Promise.scala6
-rw-r--r--src/library/scala/util/control/NonFatal.scala4
-rw-r--r--test/files/jvm/non-fatal-tests.scala4
-rw-r--r--test/files/pos/macro-implicit-invalidate-on-error.check0
-rw-r--r--test/files/pos/macro-implicit-invalidate-on-error.scala28
-rw-r--r--test/files/pos/t7983.scala31
-rw-r--r--versions.properties12
11 files changed, 92 insertions, 37 deletions
diff --git a/build.xml b/build.xml
index 648baf9bce..545d17ef58 100755
--- a/build.xml
+++ b/build.xml
@@ -285,12 +285,13 @@ TODO:
<!-- so we don't have to wait for artifacts to synch to maven central
(we don't distribute partest with Scala, so the risk of sonatype and maven being out of synch is irrelevant):
-->
- <!-- <artifact:remoteRepository refid="extra-repo"/> -->
+ <artifact:remoteRepository refid="extra-repo"/>
<dependency groupId="org.scala-lang.modules" artifactId="scala-partest_${scala.binary.version}" version="${partest.version.number}" />
</artifact:dependencies>
<copy-deps project="partest"/>
<artifact:dependencies pathId="scalacheck.classpath" filesetId="scalacheck.fileset" versionsId="scalacheck.versions">
+ <artifact:remoteRepository refid="extra-repo"/>
<dependency groupId="org.scalacheck" artifactId="scalacheck_${scala.binary.version}" version="${scalacheck.version.number}" />
</artifact:dependencies>
@@ -302,7 +303,7 @@ TODO:
<!-- used by the test.osgi target to create osgi bundles for the xml, parser-combinator jars
must specify sourcesFilesetId, javadocFilesetId to download these types of artifacts -->
<artifact:dependencies pathId="external-modules.deps.classpath" sourcesFilesetId="external-modules.sources.fileset" javadocFilesetId="external-modules.javadoc.fileset">
- <!-- <artifact:remoteRepository refid="extra-repo"/> -->
+ <artifact:remoteRepository refid="extra-repo"/>
<dependency groupId="org.scala-lang.modules" artifactId="scala-xml_${scala.binary.version}" version="${scala-xml.version.number}"/>
<dependency groupId="org.scala-lang.modules" artifactId="scala-parser-combinators_${scala.binary.version}" version="${scala-parser-combinators.version.number}"/>
</artifact:dependencies>
diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
index 01acbb8cc2..fdec1edcc0 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
@@ -388,11 +388,11 @@ trait Implicits {
*/
private def dominates(dtor: Type, dted: Type): Boolean = {
def core(tp: Type): Type = tp.dealiasWiden match {
- case RefinedType(parents, defs) => intersectionType(parents map core, tp.typeSymbol.owner)
+ case RefinedType(parents, defs) => intersectionType(parents map core, tp.typeSymbol.owner)
case AnnotatedType(annots, tp, selfsym) => core(tp)
- case ExistentialType(tparams, result) => core(result).subst(tparams, tparams map (t => core(t.info.bounds.hi)))
- case PolyType(tparams, result) => core(result).subst(tparams, tparams map (t => core(t.info.bounds.hi)))
- case _ => tp
+ case ExistentialType(tparams, result) => core(result).subst(tparams, tparams map (t => core(t.info.bounds.hi)))
+ case PolyType(tparams, result) => core(result).subst(tparams, tparams map (t => core(t.info.bounds.hi)))
+ case _ => tp
}
def stripped(tp: Type): Type = {
// `t.typeSymbol` returns the symbol of the normalized type. If that normalized type
@@ -401,23 +401,18 @@ trait Implicits {
val syms = for (t <- tp; if t.typeSymbol.isTypeParameter) yield t.typeSymbol
deriveTypeWithWildcards(syms.distinct)(tp)
}
- def sum(xs: List[Int]) = (0 /: xs)(_ + _)
- def complexity(tp: Type): Int = tp.dealiasWiden match {
- case NoPrefix =>
- 0
- case SingleType(pre, sym) =>
- if (sym.isPackage) 0 else complexity(tp.dealiasWiden)
- case TypeRef(pre, sym, args) =>
- complexity(pre) + sum(args map complexity) + 1
- case RefinedType(parents, _) =>
- sum(parents map complexity) + 1
- case _ =>
- 1
+ def complexity(tp: Type): Int = tp.dealias match {
+ case NoPrefix => 0
+ case SingleType(pre, sym) => if (sym.isPackage) 0 else complexity(tp.dealiasWiden)
+ case ThisType(sym) => if (sym.isPackage) 0 else 1
+ case TypeRef(pre, sym, args) => complexity(pre) + (args map complexity).sum + 1
+ case RefinedType(parents, _) => (parents map complexity).sum + 1
+ case _ => 1
}
def overlaps(tp1: Type, tp2: Type): Boolean = (tp1, tp2) match {
case (RefinedType(parents, _), _) => parents exists (overlaps(_, tp2))
case (_, RefinedType(parents, _)) => parents exists (overlaps(tp1, _))
- case _ => tp1.typeSymbol == tp2.typeSymbol
+ case _ => tp1.typeSymbol == tp2.typeSymbol
}
val dtor1 = stripped(core(dtor))
val dted1 = stripped(core(dted))
@@ -664,6 +659,8 @@ trait Implicits {
if (context.hasErrors)
fail("hasMatchingSymbol reported error: " + context.firstError.get.errMsg)
+ else if (itree3.isErroneous)
+ fail("error typechecking implicit candidate")
else if (isLocal && !hasMatchingSymbol(itree2))
fail("candidate implicit %s is shadowed by %s".format(
info.sym.fullLocationString, itree2.symbol.fullLocationString))
diff --git a/src/eclipse/partest/.classpath b/src/eclipse/partest/.classpath
index e2a66118b9..35528a276d 100644
--- a/src/eclipse/partest/.classpath
+++ b/src/eclipse/partest/.classpath
@@ -5,7 +5,7 @@
<classpathentry combineaccessrules="false" kind="src" path="/repl"/>
<classpathentry kind="var" path="M2_REPO/com/googlecode/java-diff-utils/diffutils/1.3.0/diffutils-1.3.0.jar"/>
<classpathentry kind="var" path="M2_REPO/org/scala-tools/testing/test-interface/0.5/test-interface-0.5.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/scala-lang/modules/scala-partest_2.11.0-M6/1.0.0-RC7/scala-partest_2.11.0-M6-1.0.0-RC7.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/scala-lang/modules/scala-partest_2.11.0-M7/1.0.0-RC8/scala-partest_2.11.0-M7-1.0.0-RC8.jar"/>
<classpathentry kind="var" path="SCALA_BASEDIR/lib/ant/ant.jar"/>
<classpathentry kind="con" path="org.scala-ide.sdt.launching.SCALA_CONTAINER"/>
<classpathentry kind="con" path="org.scala-ide.sdt.launching.SCALA_COMPILER_CONTAINER"/>
diff --git a/src/eclipse/scaladoc/.classpath b/src/eclipse/scaladoc/.classpath
index ac67fd2b03..c8f0e89b8a 100644
--- a/src/eclipse/scaladoc/.classpath
+++ b/src/eclipse/scaladoc/.classpath
@@ -6,8 +6,8 @@
<classpathentry combineaccessrules="false" kind="src" path="/scala-compiler"/>
<classpathentry combineaccessrules="false" kind="src" path="/scala-library"/>
<classpathentry combineaccessrules="false" kind="src" path="/partest-extras"/>
- <classpathentry kind="var" path="M2_REPO/org/scala-lang/modules/scala-xml_2.11.0-M6/1.0.0-RC6/scala-xml_2.11.0-M6-1.0.0-RC6.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/scala-lang/modules/scala-parser-combinators_2.11.0-M6/1.0.0-RC4/scala-parser-combinators_2.11.0-M6-1.0.0-RC4.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/scala-lang/modules/scala-partest_2.11.0-M6/1.0.0-RC7/scala-partest_2.11.0-M6-1.0.0-RC7.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/scala-lang/modules/scala-xml_2.11.0-M7/1.0.0-RC7/scala-xml_2.11.0-M7-1.0.0-RC7.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/scala-lang/modules/scala-parser-combinators_2.11.0-M7/1.0.0-RC5/scala-parser-combinators_2.11.0-M7-1.0.0-RC5.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/scala-lang/modules/scala-partest_2.11.0-M7/1.0.0-RC8/scala-partest_2.11.0-M7-1.0.0-RC8.jar"/>
<classpathentry kind="output" path="build-quick-scaladoc"/>
</classpath>
diff --git a/src/library/scala/concurrent/impl/Promise.scala b/src/library/scala/concurrent/impl/Promise.scala
index 418d859d79..b15601058e 100644
--- a/src/library/scala/concurrent/impl/Promise.scala
+++ b/src/library/scala/concurrent/impl/Promise.scala
@@ -82,11 +82,11 @@ private[concurrent] object Promise {
* 2. Complete, with a result.
* 3. Linked to another DefaultPromise.
*
- * If a DefaultPromise is linked it another DefaultPromise then it will
+ * If a DefaultPromise is linked to another DefaultPromise, it will
* delegate all its operations to that other promise. This means that two
* DefaultPromises that are linked will appear, to external callers, to have
- * exactly the same state and behaviour. E.g. they will both appear to be
- * either complete or incomplete, and with the same values.
+ * exactly the same state and behaviour. For instance, both will appear as
+ * incomplete, or as complete with the same result value.
*
* A DefaultPromise stores its state entirely in the AnyRef cell exposed by
* AbstractPromise. The type of object stored in the cell fully describes the
diff --git a/src/library/scala/util/control/NonFatal.scala b/src/library/scala/util/control/NonFatal.scala
index 11fb988e8e..9d3dfea074 100644
--- a/src/library/scala/util/control/NonFatal.scala
+++ b/src/library/scala/util/control/NonFatal.scala
@@ -11,9 +11,8 @@ package util.control
/**
* Extractor of non-fatal Throwables. Will not match fatal errors like `VirtualMachineError`
- * (for example, `OutOfMemoryError`, a subclass of `VirtualMachineError`), `ThreadDeath`,
+ * (for example, `OutOfMemoryError` and `StackOverflowError`, subclasses of `VirtualMachineError`), `ThreadDeath`,
* `LinkageError`, `InterruptedException`, `ControlThrowable`.
- * However, `StackOverflowError` is matched, i.e. considered non-fatal.
*
* Note that [[scala.util.control.ControlThrowable]], an internal Throwable, is not matched by
* `NonFatal` (and would therefore be thrown).
@@ -34,7 +33,6 @@ object NonFatal {
* Returns true if the provided `Throwable` is to be considered non-fatal, or false if it is to be considered fatal
*/
def apply(t: Throwable): Boolean = t match {
- case _: StackOverflowError => true // StackOverflowError ok even though it is a VirtualMachineError
// VirtualMachineError includes OutOfMemoryError and other fatal errors
case _: VirtualMachineError | _: ThreadDeath | _: InterruptedException | _: LinkageError | _: ControlThrowable => false
case _ => true
diff --git a/test/files/jvm/non-fatal-tests.scala b/test/files/jvm/non-fatal-tests.scala
index 791b1d3100..1ff7ee516e 100644
--- a/test/files/jvm/non-fatal-tests.scala
+++ b/test/files/jvm/non-fatal-tests.scala
@@ -4,8 +4,7 @@ trait NonFatalTests {
//NonFatals
val nonFatals: Seq[Throwable] =
- Seq(new StackOverflowError,
- new RuntimeException,
+ Seq(new RuntimeException,
new Exception,
new Throwable,
new NotImplementedError)
@@ -13,6 +12,7 @@ trait NonFatalTests {
//Fatals
val fatals: Seq[Throwable] =
Seq(new InterruptedException,
+ new StackOverflowError,
new OutOfMemoryError,
new LinkageError,
new VirtualMachineError {},
diff --git a/test/files/pos/macro-implicit-invalidate-on-error.check b/test/files/pos/macro-implicit-invalidate-on-error.check
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/files/pos/macro-implicit-invalidate-on-error.check
diff --git a/test/files/pos/macro-implicit-invalidate-on-error.scala b/test/files/pos/macro-implicit-invalidate-on-error.scala
new file mode 100644
index 0000000000..22cd2d34b4
--- /dev/null
+++ b/test/files/pos/macro-implicit-invalidate-on-error.scala
@@ -0,0 +1,28 @@
+package scala.reflect
+package api
+
+import scala.language.experimental.macros
+import scala.reflect.macros.Context
+
+trait Liftable[T] {
+ def apply(universe: api.Universe, value: T): universe.Tree
+}
+
+object Liftable {
+ implicit def liftCaseClass[T <: Product]: Liftable[T] = macro liftCaseClassImpl[T]
+
+ def liftCaseClassImpl[T: c.WeakTypeTag](c: Context): c.Expr[Liftable[T]] = {
+ import c.universe._
+ val tpe = weakTypeOf[T]
+ if (!tpe.typeSymbol.asClass.isCaseClass) c.abort(c.enclosingPosition, "denied")
+ val p = List(q"Literal(Constant(1))")
+ c.Expr[Liftable[T]] { q"""
+ new scala.reflect.api.Liftable[$tpe] {
+ def apply(universe: scala.reflect.api.Universe, value: $tpe): universe.Tree = {
+ import universe._
+ Apply(Select(Ident(TermName("C")), TermName("apply")), List(..$p))
+ }
+ }
+ """ }
+ }
+}
diff --git a/test/files/pos/t7983.scala b/test/files/pos/t7983.scala
new file mode 100644
index 0000000000..a583e538c5
--- /dev/null
+++ b/test/files/pos/t7983.scala
@@ -0,0 +1,31 @@
+package foo.bar.baz // the package nesting level material to this bug
+
+class DivergenceTest {
+
+ trait ColumnBase[T]
+
+ trait ShapeLevel
+ trait Flat extends ShapeLevel
+ trait Lower extends Flat
+
+ class Shape2[Level <: ShapeLevel, -M, U]
+
+ implicit final def columnBaseShape[Level >: Flat <: ShapeLevel, T, C <: ColumnBase[_]]
+ (implicit ev: C <:< ColumnBase[T]
+ ): Shape2[Level, C, T] = ???
+
+ implicit final def intShape[Level <: ShapeLevel, T]: Shape2[Level, Int, Int] = ???
+ implicit final def tuple2Shape[Level <: ShapeLevel, M1,M2, U1,U2]
+ (implicit u1: Shape2[_ <: Level, M1, U1],
+ u2: Shape2[_ <: Level, M2, U2]
+ ): Shape2[Level, (M1,M2), (U1,U2)] = ???
+
+ def foo {
+ class Coffees extends ColumnBase[Int]
+
+ def map1[F, T](f: F)(implicit shape: Shape2[_ <: Flat, F, T]) = ???
+
+ map1(((1, null: Coffees), 1))
+ map1(((null: Coffees, 1), 1)) // fails with implicit divergence error in 2.11.0-M6, works under 2.10.3
+ }
+}
diff --git a/versions.properties b/versions.properties
index 29cbbad884..76eea52681 100644
--- a/versions.properties
+++ b/versions.properties
@@ -1,13 +1,13 @@
-starr.version=2.11.0-M6
+starr.version=2.11.0-M7
starr.use.released=1
# These are the versions of the modules that go with this release.
# These properties are used during PR validation and in dbuild builds.
-scala.binary.version=2.11.0-M6
-partest.version.number=1.0.0-RC7
-scala-xml.version.number=1.0.0-RC6
-scala-parser-combinators.version.number=1.0.0-RC4
-scalacheck.version.number=1.10.1
+scala.binary.version=2.11.0-M7
+partest.version.number=1.0.0-RC8
+scala-xml.version.number=1.0.0-RC7
+scala-parser-combinators.version.number=1.0.0-RC5
+scalacheck.version.number=1.11.1
# TODO: modularize the compiler
#scala-compiler-doc.version.number=1.0.0-RC1