Merge branch 'override-abstract-type-dealias-kept' of https://github.com/gkossakowski/xsbt into 0.13

This commit is contained in:
Mark Harrah 2013-04-26 18:51:39 -04:00
commit 77b7c60e2b
7 changed files with 45 additions and 5 deletions

View File

@ -72,9 +72,9 @@ final class API(val global: CallbackGlobal) extends Compat
// call back to the xsbti.SafeLazy class in main sbt code to construct a SafeLazy instance
// we pass a thunk, whose class is loaded by the interface class loader (this class's loader)
// SafeLazy ensures that once the value is forced, the thunk is nulled out and so
// SafeLazy ensures that once the value is forced, the thunk is nulled out and so
// references to the thunk's classes are not retained. Specifically, it allows the interface classes
// (those in this subproject) to be garbage collected after compilation.
// (those in this subproject) to be garbage collected after compilation.
private[this] val safeLazy = Class.forName("xsbti.SafeLazy").getMethod("apply", classOf[xsbti.F0[_]])
private def lzy[S <: AnyRef](s: => S): xsbti.api.Lazy[S] =
{
@ -196,7 +196,7 @@ final class API(val global: CallbackGlobal) extends Compat
case Nullary(un) => un
case _ => t
}
private def typeDef(in: Symbol, s: Symbol): xsbti.api.TypeMember =
{
val (typeParams, tpe) =
@ -312,9 +312,13 @@ final class API(val global: CallbackGlobal) extends Compat
private def processType(in: Symbol, t: Type): xsbti.api.Type = typeCache.getOrElseUpdate((in, t), makeType(in, t))
private def makeType(in: Symbol, t: Type): xsbti.api.Type =
{
def dealias(t: Type) = t match { case TypeRef(_, sym, _) if sym.isAliasType => t.normalize; case _ => t }
dealias(t) match
val dealiased = t match {
case TypeRef(_, sym, _) if sym.isAliasType => t.dealias
case _ => t
}
dealiased match
{
case NoPrefix => Constants.emptyType
case ThisType(sym) => new xsbti.api.Singleton(thisPath(sym))

View File

@ -0,0 +1,7 @@
InputKey[Unit]("check-number-of-compiler-iterations") <<= inputTask { (argTask: TaskKey[Seq[String]]) =>
(argTask, compile in Compile) map { (args: Seq[String], a: sbt.inc.Analysis) =>
assert(args.size == 1)
val expectedIterationsNumber = args(0).toInt
assert(a.compilations.allCompilations.size == expectedIterationsNumber, "a.compilations.allCompilations.size = %d (expected %d)".format(a.compilations.allCompilations.size, expectedIterationsNumber))
}
}

View File

@ -0,0 +1,4 @@
object Bar {
def bar: Outer.TypeInner = null
// comment to trigger recompilation
}

View File

@ -0,0 +1,3 @@
object Bar {
def bar: Outer.TypeInner = null
}

View File

@ -0,0 +1,5 @@
object Outer {
class Inner { type Xyz }
type TypeInner = Inner { type Xyz = Int }
}

View File

@ -0,0 +1,3 @@
class Impl {
def bleep = Bar.bar
}

View File

@ -0,0 +1,14 @@
# Test for separate compilation and proper value of
# the OVERRIDE flag when abstract types, type alias
# and structural type are involved
# See https://github.com/sbt/sbt/issues/726 for details
# introduces first compile iteration
> compile
# this change adds a comment and does not change api so introduces
# only one additional compile iteration
$ copy-file changes/Bar1.scala src/main/scala/Bar.scala
# second iteration
#> compile
# check if there are only two compile iterations performed
> check-number-of-compiler-iterations 2