scala/scala — pull request #4094 by retronym (2014-11-06 04:25:19+00:00)
Title: SI-8962 Fix regression silent mode during patmat typechecking

During the refactoring of error reporting in 258d95, the result
of `Context#reportError` was changed once we had switched to
using a `ThrowingReporter`, which is still the case in post
typer phase typechecking

This was enough to provoke a type error in the enclosed test.
Here's a diff of the typer log:

% scalac-hash 258d95~1 -Ytyper-debug sandbox/test.scala 2>&1 | tee sandbox/good.log
% scalac-hash 258d95 -Ytyper-debug sandbox/test.scala 2>&1 | tee sandbox/bad.log
% diff -U100 sandbox/{good,bad}.log | gist --filename=SI-8962-typer-log.diff
https://gist.github.com/retronym/3ccbe7e0791447d272a6

The test `Context#reportError` happens to be used when deciding
whether the type checker should be lenient when it hits a type error.
In lenient mode (see `adaptMismatchedSkolems`), it `adapt` retries
with after slackening the expected type by replacing GADT and
existential skolems with wildcard types. This is to accomodate
known type-incorrect trees generated by the pattern matcher.

This commit restores the old semantics of `reportError`, which means
it is `false` when a `ThrowingReporter` is being used.

Review by @adriaanm