Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1607 from retronym/ticket/6640
SI-6640 Better reporting of deficient classpaths.
- Loading branch information
Showing
15 changed files
with
200 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/partest/scala/tools/partest/StoreReporterDirectTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,15 @@ | |||
package scala.tools.partest | |||
|
|||
import scala.tools.nsc.Settings | |||
import scala.tools.nsc.reporters.StoreReporter | |||
import scala.collection.mutable | |||
|
|||
trait StoreReporterDirectTest extends DirectTest { | |||
lazy val storeReporter: StoreReporter = new scala.tools.nsc.reporters.StoreReporter() | |||
|
|||
/** Discards all but the first message issued at a given position. */ | |||
def filteredInfos: Seq[storeReporter.Info] = storeReporter.infos.groupBy(_.pos).map(_._2.head).toList | |||
|
|||
/** Hook into [[scala.tools.partest.DirectTest]] to install the custom reporter */ | |||
override def reporter(settings: Settings) = storeReporter | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,3 +1,9 @@ | |||
error: bad symbolic reference to value global in class IMain - referenced from t5148.scala (a classfile may be missing) | error: bad symbolic reference. A signature in Imports.class refers to term global | ||
error: bad symbolic reference to value memberHandlers in class IMain - referenced from t5148.scala (a classfile may be missing) | in class scala.tools.nsc.interpreter.IMain which is not available. | ||
It may be completely missing from the current classpath, or the version on | |||
the classpath might be incompatible with the version used when compiling Imports.class. | |||
error: bad symbolic reference. A signature in Imports.class refers to term memberHandlers | |||
in class scala.tools.nsc.interpreter.IMain which is not available. | |||
It may be completely missing from the current classpath, or the version on | |||
the classpath might be incompatible with the version used when compiling Imports.class. | |||
two errors found | two errors found |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1 +1,4 @@ | |||
Stream((), ?) | pos: source-newSource1,line-9,offset=109 bad symbolic reference. A signature in U.class refers to term pack1 | ||
in package <root> which is not available. | |||
It may be completely missing from the current classpath, or the version on | |||
the classpath might be incompatible with the version used when compiling U.class. ERROR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,7 +1,48 @@ | |||
object Test { | import scala.tools.partest._ | ||
import java.io.File | |||
|
|
||
def main(args: Array[String]): Unit = { | object Test extends StoreReporterDirectTest { | ||
println(Stream.continually(()).filterNot(_ => false).take(2)) | def code = ??? | ||
|
|||
def compileCode(code: String) = { | |||
val classpath = List(sys.props("partest.lib"), testOutput.path) mkString sys.props("path.separator") | |||
compileString(newCompiler("-cp", classpath, "-d", testOutput.path))(code) | |||
} | } | ||
|
|
||
def library1 = """ | |||
package pack1 | |||
trait T | |||
""" | |||
|
|||
def library2 = """ | |||
package pack2 | |||
trait U extends pack1.T | |||
""" | |||
|
|||
def app = """ | |||
package pack3 | |||
object X { | |||
trait U | |||
} | |||
import X._ | |||
import pack2._ | |||
trait V extends U | |||
""" | |||
|
|||
def show(): Unit = { | |||
Seq(library1, library2) foreach compileCode | |||
assert(filteredInfos.isEmpty, filteredInfos) | |||
|
|||
// blow away the entire package | |||
val pack1 = new File(testOutput.path, "pack1") | |||
val tClass = new File(pack1, "T.class") | |||
assert(tClass.exists) | |||
assert(tClass.delete()) | |||
assert(pack1.delete()) | |||
|
|||
// bad symbolic reference error expected (but no stack trace!) | |||
compileCode(app) | |||
println(filteredInfos.mkString("\n")) | |||
} | |||
} | } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,4 @@ | |||
pos: NoPosition bad symbolic reference. A signature in U.class refers to type T | |||
in package pack1 which is not available. | |||
It may be completely missing from the current classpath, or the version on | |||
the classpath might be incompatible with the version used when compiling U.class. ERROR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,61 @@ | |||
import scala.tools.partest._ | |||
import java.io.File | |||
|
|||
object Test extends StoreReporterDirectTest { | |||
def code = ??? | |||
|
|||
def compileCode(code: String) = { | |||
val classpath = List(sys.props("partest.lib"), testOutput.path) mkString sys.props("path.separator") | |||
compileString(newCompiler("-cp", classpath, "-d", testOutput.path))(code) | |||
} | |||
|
|||
def library1 = """ | |||
package pack1 | |||
trait T | |||
class U { | |||
def t = new T {} | |||
def one = 1 | |||
} | |||
""" | |||
|
|||
def library2 = """ | |||
package pack2 | |||
object V { | |||
def u = new pack1.U | |||
} | |||
""" | |||
|
|||
def app1 = """ | |||
package pack3 | |||
object Test { | |||
pack2.V.u.one // okay | |||
} | |||
""" | |||
|
|||
def app2 = """ | |||
package pack3 | |||
object Test { | |||
pack2.V.u.t // we have to fail if T.class is misisng | |||
} | |||
""" | |||
|
|||
def show(): Unit = { | |||
compileCode(library1) | |||
val pack1 = new File(testOutput.path, "pack1") | |||
val tClass = new File(pack1, "T.class") | |||
assert(tClass.exists) | |||
assert(tClass.delete()) | |||
|
|||
// allowed to compile, no direct reference to `T` | |||
compileCode(library2) | |||
assert(filteredInfos.isEmpty, filteredInfos) | |||
|
|||
// allowed to compile, no direct reference to `T` | |||
compileCode(app1) | |||
assert(filteredInfos.isEmpty, filteredInfos) | |||
|
|||
// bad symbolic reference error expected (but no stack trace!) | |||
compileCode(app2) | |||
println(filteredInfos.mkString("\n")) | |||
} | |||
} |
5 changes: 2 additions & 3 deletions
5
test/files/run/typetags_without_scala_reflect_typetag_lookup.check
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,3 +1,2 @@ | |||
newSource1:9: error: could not find implicit value for evidence parameter of type reflect.runtime.package.universe.TypeTag[Int] |
|
||
Library.foo[Int] | pos: source-newSource1,line-9,offset=466 could not find implicit value for evidence parameter of type reflect.runtime.package.universe.TypeTag[Int] ERROR | ||
^ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 2 additions & 3 deletions
5
test/files/run/typetags_without_scala_reflect_typetag_manifest_interop.check
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,3 +1,2 @@ | |||
newSource1:9: error: No Manifest available for App.this.T. |
|
||
manifest[T] | pos: source-newSource1,line-9,offset=479 No Manifest available for App.this.T. ERROR | ||
^ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters