scala/scala — pull request #1607 by retronym (2012-11-10 14:40:42+00:00)
Title: SI-6640 Better reporting of deficient classpaths.

In a55788e, StubSymbols were introduced to fail-slow when
the classpath was deficient. This allowed compilation to
succeed in cases when one didn't actually use the part of
class A which referred to some missing class B.

But a few problems were introduced.

Firstly, when the deferred error eventually happened, it was
signalled with abort(msg), rather than through a thrown
MissingRequirementError. The latter is desirable, as it doesn't
lead to printing a stack trace.

Second, the actual error message changed, and no longer
included the name of the class file that refers to the missing
class.

Finally, it seems that we can end up with a stub term symbol
in a situation where a class symbol is desired. An assertion
in the constructor of ThisType throws trips when calling .isClass,
before the useful error message from StubSymbol can be emitted.

This commit addresses these points, and rewords the error
a little to be more accessible. The last point is the most fragile
in this arrangement, there might be some whack-a-mole
required to similar assertions. I don't see a clean solution
for this, but am open to suggestions.

We should really build a facility in partest to delete
specified classfiles between groups in separate compilation
tests, in order to have tests for this. I'll work on that as a followup.

For now, here's the result of my manual testing:

```
[info] Set current project to default-821d14 (in build file:/Users/jason/code/scratch1/)
> compile

[info] Compiling 1 Scala source to /Users/jason/code/scratch1/target/scala-2.10/classes...
[error]
[error] while compiling: /Users/jason/code/scratch1/test.scala
[error] during phase: typer
[error] library version: version 2.10.0-RC2
[error] compiler version: version 2.10.0-RC2
...
[error] last tree to typer: Ident(SwingWorker)
[error] symbol: (flags: )
[error] symbol definition:
[error] symbol owners:
[error] context owners: object Test -> package
...
[error] uncaught exception during compilation: java.lang.AssertionError
[trace] Stack trace suppressed: run last compile:compile for the full output.
[error] (compile:compile) java.lang.AssertionError: assertion failed: value actors
[error] Total time: 2 s, completed Nov 10, 2012 3:18:34 PM
>
> set scalaHome := Some(file("/Users/jason/code/scala/build/pack"))
[info] Defining *:scala-home
[info] The new value will be used by no settings or tasks.
[info] Reapplying settings...
[info] Set current project to default-821d14 (in build file:/Users/jason/code/scratch1/)
^[compile
[info] Compiling 1 Scala source to /Users/jason/code/scratch1/target/scala-2.10/classes...
[error] /Users/jason/code/scratch1/test.scala:4: A signature in SwingWorker.class refers to term actors in package scala which is missing from the classpath.
[error] object Test extends SwingWorker
[error] ^
[error] one error found
[error] (compile:compile) Compilation failed
[error] Total time: 2 s, completed Nov 10, 2012 3:18:45 PM
```

Review by @paulp @jsuereth

While perhaps not strictly a blocker in its own right, I would lobby to include it if we need another RC.