| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| | |
part 2 of the big error reporting refactoring
|
| |
| |
| |
| | |
Do it consistently...
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Move code that manipulates the error buffers / reporters
into combinators in Context/ContextReporter.
Eventually, would like to statically know when we're in silent mode,
and only then use buffering (push buffering code down to BufferingReporter).
Simplify TryTwice; avoid capturing mutable var in closure.
Changed inSilentMode to no longer check `&& !reporter.hasErrors`;
disassembling optimized code showed that this was keeping the inliner
from inlining this method.
Introduce a couple more combinators:
- withFreshErrorBuffer
- propagatingErrorsTo
- propagateImplicitTypeErrorsTo
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Could not figure it out, so resorting to brain dumping.
something with private classes and defaults,
the default getter will be in the private companion module,
but there's no accessor to get the module???
maybe something related to make non-private of the accessor?
while running the repl or, e.g., the test presentation/ide-t1000567
AbstractMethodError: scala.tools.nsc.interactive.Global$$anon$5.scala$tools$nsc$typechecker$Contexts$$BufferingReporter()Lscala/tools/nsc/typechecker/Contexts$BufferingReporter$;
at scala.tools.nsc.typechecker.Contexts$Context.makeSilent(Contexts.scala:518)
in progress minimal repro:
```
package a
class Reporter
class Global {
lazy val analyzer = new {
val global: Global.this.type = Global.this
} with Analyzer
}
trait Analyzer extends AnyRef with Contexts {
val global : Global
}
trait Contexts { self: Analyzer =>
// the accessor to get to ContextReporter's companion object
// to get the default for x is not emitted for some reason
// the expected accessor is the non-private version
// `def scala$tools$nsc$typechecker$Contexts$$BufferingReporter: scala.tools.nsc.typechecker.Contexts#BufferingReporter$`
// (as seen in the AbstractMethodError's message)
abstract class ContextReporter(x: Any = null) extends Reporter
private class ThrowingReporter extends ContextReporter
class Context(a: Any, private[this] var _reporter: ContextReporter = new ThrowingReporter) {
def reporter = _reporter
}
object NoContext extends Context(null)
}
package b
trait ReplGlobal extends a.Global {
// this anon class corresponds to scala.tools.nsc.interactive.Global$$anon$5 in the above AbstractMethodError
override lazy val analyzer = new {
val global: ReplGlobal.this.type = ReplGlobal.this
} with a.Analyzer { }
}
```
|
| |
| |
| |
| |
| |
| |
| |
| | |
Next step: more principled buffering, make use of the single-entry point reporter.
First example simplification in `TryTwice`:
No need to store and restore errors -- just use a fresh reporter.
Also, control-flow with vars ftw.
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Reporting mode used to be governed by contextMode.
This logic is left in place by this commit, and the consistency
of the new and the old is checked. Will be removed in follow-up commit.
The main difference is that we no longer throw TypeErrors in buffering mode.
There was one instance of context.error in implicit search the exploited the
fact that implicit search runs in buffering (silent) mode and thus calls to
error(pos,msg) used to throw new TypeError(pos, msg) -- made this explicit,
and removed throwing behavior from the buffering context reporter.
|
| | |
|
| | |
|
| |
| |
| |
| | |
This is used by the tree checkers.
|
| |
| |
| |
| | |
The overload was used only once.
|
| |
| |
| |
| |
| |
| |
| |
| | |
It's the superclass for type errors that should be issued
with `issueAmbiguousError`.
TODO: enforce this in `issues` itself using a type test,
remove the static overload.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Now that all reporting mode manipulators are private to Context,
let's untangle this logic:
- every `setReportErrors` gets a corresponding `setAmbiguousErrors(true)`
- every `setBufferErrors` gets a corresponding `setAmbiguousErrors(false)`
- every `setThrowErrors` gets a corresponding `setAmbiguousErrors(false)`
`ambiguousErrors` means that ambiguity errors *must* be reported,
even when in silent mode. When it's false, they are *not* reported,
but they are buffered when the context reporter is buffering.
TODO: this seems a bit dubious, but this is what happens now.
Let's see if we can simplify this once the refactoring is complete.
Again, the end goal is a strategy-based approach to reporting,
where the reporting mode is captured in the reporter being used,
with as little mutation as possible to capture more invariants
(would like to stop throwing TypeError eventually and only have two reporters:
buffering reporter, regular reporter)
|
| | |
|
| |
| |
| |
| |
| |
| | |
This allows local reasoning about these bits,
giving some more confidence for the refactoring
that's underway.
|
| | |
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| |
| | |
The overarching goal is to route all contextual reporting
through a single entry point: `context.reporter`.
The following commits take baby steps towards this goal.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
`typer.TyperErrorGen.MacroCantExpandIncompatibleMacrosError`
throws because the type checker it uses is at `NoContext`,
which throws by default... This default is bad and is going to change,
so make this code independent of that future sanity.
TODO: don't use mutable state to determine position for the error
|
| |
| |
| |
| |
| |
| | |
- when warning must not be suppressed, use `reporter.warning`
- don't (implicitly) rely on `reporter.warning` being silent after typer
--> don't do pure expression check after typer
|
| |
| |
| |
| | |
Introduce `initRootContext` to set the relevant bits.
|
| |
| |
| |
| |
| | |
All functionality that's closely tied to the error buffer should be in
`Context`'s reporting infrastructure. (called `ContextReporter`, soon to follow.)
|
| |
| |
| |
| | |
Setting the scene of removing the reporting mode bits from `contextMode`.
|
| | |
|
| |
| |
| |
| |
| |
| | |
Once a release with this method is out,
move partest to use errorCount and cut ties with the Severity
nested class, so we can move it to the right enclosing class.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Once we get the next diagnostic, lets encapsulate them in an
object, with a boolean flag for each one when it needs to trigger,
and a nice message that should be presented to our delighted user.
A list of Strings that is searched by contents is a bit fragile,
and can't be very fast either.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The two functional differences are:
- always add the diagnostics string
- check erroneousness in `issueAmbiguousTypeErrorUnlessErroneous`,
before even constructing the error message.
Consider this nugget:
```
- def issueAmbiguousError(pre: Type, sym1: Symbol, sym2: Symbol, err: AbsTypeError) {
- issueCommon(err) { case _ if ambiguousErrors =>
- if (!pre.isErroneous && !sym1.isErroneous && !sym2.isErroneous)
```
I'd like to state for the record that the if-erroneous in the
case of the partial function looked super-dodgy: it meant that,
when `ambiguousErrors`, `issueCommon` would not get to the `else` branches
that buffer or throw, and if the erroneous condition was met,
nothing would be issued/buffered/thrown.
This refactoring checks this condition up front.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
In this case, `infer.issue -> context.issue`.
Forwarders are dead weight that cause bit rot.
They tend to acquire functionality,
clutter their defining interface and
dilute the purpose of the method they forward to.
|
| |
| |
| |
| |
| |
| | |
Create a trait Parsing, which, like Reporting,
factors our functionality from Global (aka. "the cake"),
that is related to global aspects of configuring parsing.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This is currently pretty borken,
but let's at least not clutter innocent
interfaces with this functionality.
Moved `comment` (as `signalParsedDocComment`) next to
the other hook methods in `Global`. For now, it calls
the old `reporter.comment` hook method.
As soon as the IDE is refactored to receive comments properly,
the deprecated `Reporter#comment` method can be removed.
|
| | |
|
| | |
|
|\ \
| | |
| | | |
SI-1264 SI-5227 fsc isn't very good at returning error messages
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Fsc shoudln't just write to its own stderr when a major compiler crash
happens, it should also send an error to the client (`scala -e` for
example).
Otherwise the client thinks everything went fine (silence == success)
and tries to run something, crashes too, and displays only its own
error, not the original one.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This properly sends the compiler output of `scala -e`, scala worksheets,
... to sdterr, just like scalac does.
Before:
$ scala -e 'foo' > /dev/null
$
After:
$ scala -e 'foo' > /dev/null
/tmp/scalacmd8514641341855028538.scala:1: error: not found: value foo
foo
^
one error found
$
|
|\ \ \
| |/ /
|/| | |
Add support for running a specific Junit test/method.
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Unless I really missed something, there is currently no way to run a
specific Junit test (class or method). Running the whole thing is going
to get worse and worse since Junit is supposed to be the preferred way,
so here it goes:
// will run all methods in a test file
ant test.junit -Dtest.class=scala.WhateverTest
// will run a specific method (just an alias for the one below)
ant test.junit -Dtest.class=scala.WhateverTest -Dtest.method=mymethod
// will run several methods (comma separated)
ant test.junit -Dtest.class=scala.WhateverTest -Dtest.methods="foo,bar"
`test.method(s)` without `test.class` is just ignored (all tests are
run).
|
|\ \
| | |
| | | |
SI-8787 Regextraction is null-proof
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Simplify the exposition and update the examples.
Emphasize pattern matching, especially using `r.unanchored`
instead of `for (r(x,y,z) <- r findFirstIn text)`.
Certain details are moved to method docs.
It would be nice to fix matching package doc,
but the doc must attach to the package object, it seems.
Introducing a package object is not binary-compatible.
Includes a doc line edit on 2.12, anticipating the merge.
|
| | |
| | |
| | |
| | | |
Regex is robust when unapplying null. A null never matches.
|
|\ \ \
| | | |
| | | | |
SI-8512 Infer a type for f"$args"
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Avoid the widening bug for q. This resolution also suffers
from the inference of Any, which can trigger a warning and
an anxiety attack. But that's still better than doing the
wrong thing.
Right?
|
|/ / /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The f-interpolator gets a type param that better be Any to avoid
unfortunate widenings.
Hey, it worked!
Unfortunately, when `Any` is inferred, `-Xlint:infer-any` takes notice.
This is probably a greater problem for the f-interpolator than for
quasiquotes, which are a more specialized tool.
|
|\ \ \
| | | |
| | | | |
test for InnerClass and EnclosingMethod attributes
|
| |/ /
| | |
| | |
| | |
| | |
| | | |
Some parts of the test assert (current) buggy behavior. This is marked
in the test file with TODO. It will be fixed in later work on the
backend.
|
|\ \ \
| | | |
| | | | |
a few missing deprecations in proxy collections.
|