mirror of https://github.com/sbt/sbt.git
Fix compile error in Eclipse
Let's consider compile/inc/src/main/scala/sbt/CompileSetup.scala. There are multiple Output types, and according to Eclipse importing xsbti.compile.Output within the package sbt does not work because the import is shadowed by sbt.Output. However, compilation proceeds just fine within SBT. Reproducing the example however gives the same warning, if the files are in the same project. The problem here is probably that the shadowing Output is declared in the same package but in another project, and that seems to give different results in Eclipse and SBT, but relying on that looks fragile. Reading the spec is inconclusive since it doesn't match with Scalac's behavior — see https://groups.google.com/d/topic/scala-internals/-Rquc2HBYLk/discussion . ForkTests has the same behavior as CompileSetup.
This commit is contained in:
parent
e6d1d02d1e
commit
19aaaea923
|
|
@ -3,7 +3,7 @@
|
|||
*/
|
||||
package sbt
|
||||
|
||||
import xsbti.compile.{ CompileOrder, Output, SingleOutput, MultipleOutput }
|
||||
import xsbti.compile.{ CompileOrder, Output => APIOutput, SingleOutput, MultipleOutput}
|
||||
import java.io.File
|
||||
|
||||
// this class exists because of Scala's restriction on implicit parameter search.
|
||||
|
|
@ -11,12 +11,12 @@ package sbt
|
|||
// because complexity(Equiv[Seq[String]]) > complexity(Equiv[CompileSetup])
|
||||
// (6 > 4)
|
||||
final class CompileOptions(val options: Seq[String], val javacOptions: Seq[String])
|
||||
final class CompileSetup(val output: Output, val options: CompileOptions, val compilerVersion: String, val order: CompileOrder)
|
||||
final class CompileSetup(val output: APIOutput, val options: CompileOptions, val compilerVersion: String, val order: CompileOrder)
|
||||
|
||||
object CompileSetup
|
||||
{
|
||||
// Equiv[CompileOrder.Value] dominates Equiv[CompileSetup]
|
||||
implicit def equivCompileSetup(implicit equivOutput: Equiv[Output], equivOpts: Equiv[CompileOptions], equivComp: Equiv[String]/*, equivOrder: Equiv[CompileOrder]*/): Equiv[CompileSetup] = new Equiv[CompileSetup] {
|
||||
implicit def equivCompileSetup(implicit equivOutput: Equiv[APIOutput], equivOpts: Equiv[CompileOptions], equivComp: Equiv[String]/*, equivOrder: Equiv[CompileOrder]*/): Equiv[CompileSetup] = new Equiv[CompileSetup] {
|
||||
def equiv(a: CompileSetup, b: CompileSetup) =
|
||||
equivOutput.equiv(a.output, b.output) &&
|
||||
equivOpts.equiv(a.options, b.options) &&
|
||||
|
|
@ -26,8 +26,8 @@ object CompileSetup
|
|||
implicit val equivFile: Equiv[File] = new Equiv[File] {
|
||||
def equiv(a: File, b: File) = a.getAbsoluteFile == b.getAbsoluteFile
|
||||
}
|
||||
implicit val equivOutput: Equiv[Output] = new Equiv[Output] {
|
||||
def equiv(out1: Output, out2: Output) = (out1, out2) match {
|
||||
implicit val equivOutput: Equiv[APIOutput] = new Equiv[APIOutput] {
|
||||
def equiv(out1: APIOutput, out2: APIOutput) = (out1, out2) match {
|
||||
case (m1: MultipleOutput, m2: MultipleOutput) =>
|
||||
m1.outputGroups zip (m2.outputGroups) forall {
|
||||
case (a,b) =>
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@ import scala.collection.mutable
|
|||
import org.scalatools.testing._
|
||||
import java.net.ServerSocket
|
||||
import java.io._
|
||||
import Tests._
|
||||
import Tests.{Output => TestOutput, _}
|
||||
import ForkMain._
|
||||
|
||||
private[sbt] object ForkTests {
|
||||
def apply(frameworks: Seq[TestFramework], tests: List[TestDefinition], config: Execution, classpath: Seq[File], javaHome: Option[File], javaOpts: Seq[String], log: Logger): Task[Output] = {
|
||||
def apply(frameworks: Seq[TestFramework], tests: List[TestDefinition], config: Execution, classpath: Seq[File], javaHome: Option[File], javaOpts: Seq[String], log: Logger): Task[TestOutput] = {
|
||||
val opts = config.options.toList
|
||||
val listeners = opts flatMap {
|
||||
case Listeners(ls) => ls
|
||||
|
|
|
|||
Loading…
Reference in New Issue