summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'upstream/2.11.x' into backportsLukas Rytz2014-08-26131-815/+1383
|\ | | | | | | | | Conflicts: src/library/scala/util/matching/Regex.scala
| * Merge pull request #3929 from retronym/ticket/8793Lukas Rytz2014-08-262-2/+23
| |\ | | | | | | SI-8793 Fix patmat regression with extractors, existentials
| | * SI-8793 Fix patmat regression with extractors, existentialsJason Zaugg2014-08-152-2/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the same vein as SI-8128 / 3e9e2c65a, revert to the 2.10.x style of determining the types of the product elements of an extractor when using `TupleN`. I believe we can discard the special casing for Option/Tuple/Seq altogether with judicious application of `repackExistential` in `unapplyMethodTypes`. That ought to also fix fix SI-8149. But I'll target that work at 2.12.x.
| * | Merge pull request #3886 from adriaanm/report-filterGrzegorz Kossakowski2014-08-2629-480/+572
| |\ \ | | | | | | | | part 2 of the big error reporting refactoring
| | * | Encapsulate creating SilentResultValue/SilentTypeError.Adriaan Moors2014-08-041-10/+12
| | | | | | | | | | | | | | | | Do it consistently...
| | * | Separate statistics from functional code; optimize.Adriaan Moors2014-08-041-32/+45
| | | |
| | * | Towards more privacy for _reporter.Adriaan Moors2014-08-044-108/+130
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| | * | Work around weird AbstractMethodErrorAdriaan Moors2014-08-041-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 { } } ```
| | * | Cleanup ContextReporter hierarchyAdriaan Moors2014-07-181-94/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| | * | s/reportBuffer/reporterAdriaan Moors2014-07-185-66/+65
| | | |
| | * | Remove dead code: mode settingAdriaan Moors2014-07-181-37/+12
| | | |
| | * | Encapsulate reporting mode as class of reportBuffer.Adriaan Moors2014-07-183-53/+113
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| | * | Clarify that ThrowErrors is the defaultAdriaan Moors2014-07-181-8/+8
| | | |
| | * | repl depends on jline-2.12Adriaan Moors2014-07-181-2/+2
| | | |
| | * | Configure `checking` mode in `rootContext`.Adriaan Moors2014-07-172-21/+11
| | | | | | | | | | | | | | | | This is used by the tree checkers.
| | * | Remove `def error(pos: Position, err: Throwable)`Adriaan Moors2014-07-172-6/+1
| | | | | | | | | | | | | | | | The overload was used only once.
| | * | Introduce `AbsAmbiguousTypeError`.Adriaan Moors2014-07-171-5/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| | * | Untangle reporting of ambiguous errors.Adriaan Moors2014-07-171-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
| | * | Reduce Context iface: remove dead code.Adriaan Moors2014-07-171-37/+0
| | | |
| | * | Reduce Context iface: make contextMode mutators private.Adriaan Moors2014-07-171-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | This allows local reasoning about these bits, giving some more confidence for the refactoring that's underway.
| | * | Reduce Context iface: inline internally.Adriaan Moors2014-07-171-5/+6
| | | |
| | * | Reduce Context iface: encapsulate buffer manipulation.Adriaan Moors2014-07-174-37/+44
| | | |
| | * | Reduce Context iface: inline complex forwarders.Adriaan Moors2014-07-172-11/+19
| | | |
| | * | Reduce Context iface: inline trivial forwarders.Adriaan Moors2014-07-173-18/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| | * | Make more explicit that TypeError is being thrown.Adriaan Moors2014-07-172-12/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `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
| | * | Rely less on intricacies of `contextMode`-based reporting.Adriaan Moors2014-07-173-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | - 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
| | * | Restrict `contextMode` fiddling to `Context`Adriaan Moors2014-07-174-8/+28
| | | | | | | | | | | | | | | | Introduce `initRootContext` to set the relevant bits.
| | * | Encapsulate `TryTwice` as a class, move to `Context`.Adriaan Moors2014-07-172-82/+96
| | | | | | | | | | | | | | | | | | | | All functionality that's closely tied to the error buffer should be in `Context`'s reporting infrastructure. (called `ContextReporter`, soon to follow.)
| | * | Extract the `makeNonSilent` method.Adriaan Moors2014-07-172-2/+7
| | | | | | | | | | | | | | | | Setting the scene of removing the reporting mode bits from `contextMode`.
| | * | Clarify divergentError commentAdriaan Moors2014-07-171-1/+2
| | | |
| | * | Add errorCount to wean partest off Reporter$SeverityAdriaan Moors2014-07-171-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | 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.
| | * | Concretize diagnostics: one boolean suffices for now.Adriaan Moors2014-07-172-11/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| | * | Simplify (ambiguous) error issuing.Adriaan Moors2014-07-174-39/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| | * | Remove another redundant forwarderAdriaan Moors2014-07-173-7/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| | * | Move more parsing hooks out of reporting.Adriaan Moors2014-07-179-24/+46
| | | | | | | | | | | | | | | | | | | | | | | | Create a trait Parsing, which, like Reporting, factors our functionality from Global (aka. "the cake"), that is related to global aspects of configuring parsing.
| | * | Regularize `comment` hook methodAdriaan Moors2014-07-173-8/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| | * | Minor cleanup in AbstractReporter.Adriaan Moors2014-07-171-1/+3
| | | |
| | * | Eclipse project: repl depends on compiler/lib projectsAdriaan Moors2014-07-171-8/+8
| | | |
| * | | Merge pull request #3943 from gourlaysama/wip/fscLukas Rytz2014-08-262-1/+3
| |\ \ \ | | | | | | | | | | SI-1264 SI-5227 fsc isn't very good at returning error messages
| | * | | SI-5227 make fsc notify its client upon compiler crashAntoine Gourlay2014-08-251-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| | * | | SI-1264 fsc compiler output should go to stderr, like scalacAntoine Gourlay2014-08-251-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 $
| * | | | Merge pull request #3942 from gourlaysama/wip/junitGrzegorz Kossakowski2014-08-251-1/+5
| |\ \ \ \ | | |/ / / | |/| | | Add support for running a specific Junit test/method.
| | * | | Add support for running a specific Junit test/method.Antoine Gourlay2014-08-251-1/+5
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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).
| * | | Merge pull request #3923 from som-snytt/issue/8787Grzegorz Kossakowski2014-08-192-169/+262
| |\ \ \ | | | | | | | | | | SI-8787 Regextraction is null-proof
| | * | | SI-8787 Addressing feedback, additional periods.Som Snytt2014-08-121-31/+65
| | | | |
| | * | | SI-8787 Update doc for RegexSom Snytt2014-08-101-134/+175
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| | * | | SI-8787 If you love nulls, so does RegexSom Snytt2014-08-082-10/+28
| | | | | | | | | | | | | | | | | | | | Regex is robust when unapplying null. A null never matches.
| * | | | Merge pull request #3909 from som-snytt/issue/8512Grzegorz Kossakowski2014-08-196-4/+40
| |\ \ \ \ | | |_|_|/ | |/| | | SI-8512 Infer a type for f"$args"
| | * | | SI-8512 Infer Any for the qSom Snytt2014-08-123-2/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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?
| | * | | SI-8512 Infer a type for f"$args"Som Snytt2014-08-123-2/+15
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.