summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Use countElementsAsString for summarized warnings.Adriaan Moors2014-07-0420-23/+23
|
* Encapsulate deprecation warning message synthesis.Adriaan Moors2014-07-044-3/+9
| | | | | | | Both refchecks and typer constructed the same message. But different. Now with more DRYness. Note that no check files had to be updated (disconcerting)...
* Remove deprecationWarning, currentReporting from ReportingAdriaan Moors2014-07-047-33/+59
| | | | | | | | This moves us a bit closer to the goal of having a single entry point to reporting. Must modularize Reporting a bit so it can be used in Variances (need a reference to `currentRun` in `reflect.internal.Reporting`).
* Rip out reporting indirection from CompilationUnitAdriaan Moors2014-07-0444-175/+152
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Inline the forwarders from CompilationUnit, which should not affect behavior. Since all forwarders lead to global.reporter, don't first navigate to a compilation unit, only to then forward back to global.reporter. The cleanup in the previous commits revealed a ton of confusion regarding how to report an error. This was a mechanical search/replace, which has low potential for messing things up, since the list of available methods are disjoint between `reporter` and `currentRun.reporting`. The changes involving `typer.context` were done previously. Essentially, there are three ways to report: - via typer.context, so that reporting can be silenced (buffered) - via global.currentRun.reporting, which summarizes (e.g., deprecation) - via global.reporter, which is (mostly) stateless and straightforward. Ideally, these should all just go through `global.currentRun.reporting`, with the typing context changing that reporter to buffer where necessary. After the refactor, these are the ways in which we report (outside of typer): - reporter.comment - reporter.echo - reporter.error - reporter.warning - currentRun.reporting.deprecationWarning - currentRun.reporting.incompleteHandled - currentRun.reporting.incompleteInputError - currentRun.reporting.inlinerWarning - currentRun.reporting.uncheckedWarning Before: - c.cunit.error - c.enclosingUnit.deprecationWarning - context.unit.error - context.unit.warning - csymCompUnit.warning - cunit.error - cunit.warning - currentClass.cunit.warning - currentIClazz.cunit.inlinerWarning - currentRun.currentUnit.error - currentRun.reporting - currentUnit.deprecationWarning - currentUnit.error - currentUnit.warning - getContext.unit.warning - getCurrentCUnit.error - global.currentUnit.uncheckedWarning - global.currentUnit.warning - global.reporter - icls.cunit.warning - item.cunit.warning - reporter.comment - reporter.echo - reporter.error - reporter.warning - reporting.deprecationWarning - reporting.incompleteHandled - reporting.incompleteInputError - reporting.inlinerWarning - reporting.uncheckedWarning - typer.context.unit.warning - unit.deprecationWarning - unit.echo - unit.error - unit.incompleteHandled - unit.incompleteInputError - unit.uncheckedWarning - unit.warning - v1.cunit.warning All these methods ended up calling a method on `global.reporter` or on `global.currentRun.reporting` (their interfaces are disjoint). Also clean up `TypeDiagnostics`: inline nearly-single-use private methods.
* Route type checker reporting through contextAdriaan Moors2014-07-044-28/+36
| | | | | | | | | | Continue the work started in SI-8450 (no "implicit numeric widening" warning in silent mode), which was caused by going straight to the reporter instead of using the context for type error reporting (which buffers in silent mode). Ideally, this mistake should not be possible: typer should change the current reporter to buffer where appropriate.
* Track symbol that caused a deprecation warning.Adriaan Moors2014-07-048-22/+30
| | | | | | | | | | | | So that we can filter deprecations based on defining package. Configurable error reporting will support a rule like: "In compilation unit X, escalate deprecation warnings that result from accessing members in package P that have been deprecated since version V. Report an error instead of a warning for those." TODO: remove deprecationWarning overload that doesn't take a `Symbol`? (Replace by a default value of `NoSymbol` for the deprecated symbol arg?)
* Uniformly route reporting through reporter.Adriaan Moors2014-07-047-58/+116
| | | | | | | | | | | | Sharpen interfaces, reduce footprint of Reporting trait. Ideally, all reporting should indirect through reporter, and the `Reporting` trait itself should be restricted to a single method that retrieves the current `reporter`. Pull up some more reporting to reflect.internal. Would like to do more, but need to move partest to the reflect.internal interface first. (Its `errorCount` relies on `ERROR.count` in `tools.nsc.Reporter`.)
* Move reporting logic into Reporting traitAdriaan Moors2014-07-0420-193/+268
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move code from Global/SymbolTable to separate Reporting traits to start carving out an interface in scala.reflect.internal.Reporting, with internals in scala.tools.nsc. Reporting is mixed into the cake. It contains a nested class PerRunReporting. Should do the same for debugging/logging. The idea is that CompilationUnit and Global forward all reporting to Reporter. The Reporting trait contains these forwarders, and PerRunReporting, which accumulates warning state during a run. In the process, I slightly changed the behavior of `globalError` in reflect.internal.SymbolTable: it used to abort, weirdly. I assume that was dummy behavior to avoid introducing an abstract method. It's immediately overridden in Global, and I couldn't find any other subclasses, so I don't think the behavior in SymbolTable was ever observed. Provide necessary hooks for scala.reflect.macros.Parsers#parse. See scala/reflect/macros/contexts/Parsers.scala's parse method, which overrides the reporter to detect when parsing goes wrong. This should be refactored, but that goes beyond the scope of this PR. Don't pop empty macro context stack. (Ran into this while reworking -Xfatal-warnings logic.) Fix -Xfatal-warnings behavior (and check files): it wasn't meant to influence warning reporting, except for emitting one final error; if necessary to fail the compile (when warnings but no errors were reported). Warnings should stay warnings. This was refactored in fbbbb22946, but we soon seem to have relapsed. An hour of gitfu did not lead to where it went wrong. Must've been a merge.
* Pure refactor: reorder definitionsAdriaan Moors2014-07-041-23/+32
|
* Unclutter Reporter. Move truncation to ReplReporter.Adriaan Moors2014-07-0411-62/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Refactor to reduce the Reporter interface. Working towards minimal interfaces in scala.reflect.internal that can be consumed by sbt/IDE/.... The scala.tools.nsc package is entirely private to the compiler (in principle). A `Reporter` should only be used to inform (info/warning/error). No state. Ideally, we'd move to having only one reporter, whose lifetime is adjusted appropriately (from per-run in general to per-context for type checking, so errors can be buffered -- "silenced" -- during nested type checking calls). Start the clean up by moving truncation to the REPL, since it's not relevant for regular reporting. Perversely, we were checking truncation all the time, even though it's only on during a repl run. (Truncation is now always turned off in the repl under -verbose.) Untangle error resetting on symbols from error reporting (reportAdditionalErrors). This fixes a nice&subtle bug that caused feature warnings to be suppressed under `-Xfatal-warnings`: ``` def reportCompileErrors() { if (!reporter.hasErrors && reporter.hasWarnings && settings.fatalWarnings) globalError("No warnings can be incurred under -Xfatal-warnings.") if (reporter.hasErrors) { ... } else { // will erroneously not get here if // `reporter.hasWarnings && settings.fatalWarnings` // since the `globalError` call above means `reporter.hasErrors`... allConditionalWarnings foreach (_.summarize()) ... } } ``` The second `if`'s condition depends on the `globalError` call in the first `if`...
* Merge pull request #3842 from Ichoran/issue/8335Adriaan Moors2014-07-041-4/+2
|\ | | | | SI-8335 List.++ avoidably burns memory
| * SI-8335 List.++ avoidably burns memoryRex Kerr2014-06-271-4/+2
| | | | | | | | Changed to check the identity of the CanBuildFrom instead of the identity of the generated builder to shortcut building. Should reduce memory churn on ++ a little.
* | Merge pull request #3788 from som-snytt/issue/8494Adriaan Moors2014-07-041-40/+56
|\ \ | | | | | | SI-8494 Restore filtering javap output
| * | SI-8494 Javap filter includes specializedSom Snytt2014-05-231-8/+13
| | | | | | | | | | | | | | | | | | When filtering javap output, include specialized versions of methods. For anonfuns, in particular, the apply$sp is the method of interest.
| * | SI-8494 Restore filtering javap outputSom Snytt2014-05-231-33/+44
| | | | | | | | | | | | | | | | | | | | | Regressed in support for new delayedEndPoint, where it must pick what to filter for. `s/claas/klass/` and similar.
* | | Merge pull request #3840 from Ichoran/issue/8638Adriaan Moors2014-07-041-21/+27
|\ \ \ | | | | | | | | SI-8638 Empty UnrolledBuffer hangs on prepend.
| * | | SI-8638 Empty UnrolledBuffer hangs on prepend.Rex Kerr2014-06-271-21/+27
| | |/ | |/| | | | | | | | | | | | | Tracked down bug to incorrect recursion in insertAll. Fixed by adding a missing case (which incidentally will provide better performance when adding to the end of a block). No specific tests, as this is caught by quasi-complete collections tests.
* | | Merge pull request #3841 from Ichoran/issue/5200Adriaan Moors2014-07-032-12/+12
|\ \ \ | | | | | | | | SI-5200 Incorrect advice for implementing mutable.Set in scaladoc
| * | | SI-5200 Incorrect advice for implementing mutable.Set in scaladocRex Kerr2014-06-272-12/+12
| |/ / | | | | | | | | | Fixed advice; it was already there in mutable.SetLike but a case sensitivity error kept it from appearing.
* | | Merge pull request #3839 from Ichoran/issue/7115Adriaan Moors2014-07-033-1/+24
|\ \ \ | | | | | | | | SI-7115 JMapWrapper.get can incorrectly return Some(null)
| * | | SI-7115 JMapWrapper.get can incorrectly return Some(null)Rex Kerr2014-06-273-1/+24
| |/ / | | | | | | | | | | | | | | | | | | | | | This isn't incorrect. Trying to use a single-threaded interface in a concurrent context is supposed to break in various unpleasant ways. Documentation has been added to encourage one to avoid wrapping a concurrent map in the generic wrapper (which assumes a single thread), and pointing out that synchronized maps do not maintain synchronization for non-atomic operations (including get). More docs.
* | | Merge pull request #3834 from Ichoran/issue/7577Adriaan Moors2014-07-034-3/+4
|\ \ \ | | | | | | | | SI-7577 Incorrect documentation: current default isn't Vector
| * | | SI-7577 Incorrect documentation: current default isn't VectorRex Kerr2014-06-264-3/+4
| | | | | | | | | | | | | | | | Fixed documentation to specify List in four cases where it was wrong or missing.
* | | | Merge pull request #3736 from VladimirNik/print-types-issue-2.11.xAdriaan Moors2014-07-032-40/+78
|\ \ \ \ | | | | | | | | | | SI-8447 fix TypeTree printing (2.11.x)
| * | | | TypeTree printing modified (SI-8447)VladimirNik2014-05-092-40/+78
| | | | |
* | | | | Merge pull request #3772 from densh/si/8609Adriaan Moors2014-07-032-0/+14
|\ \ \ \ \ | | | | | | | | | | | | SI-8609 Fix flattening of definitions and imports in quasiquotes
| * | | | | SI-8609 Fix flattening of definitions and imports in quasiquotesDenys Shabalin2014-05-212-0/+14
| | |_|_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Quasiquotes allow to unquote trees with ..$ with block flattening semantics to simplify composition: val onetwo = q"1; 2" val onetwothree = q"..$onetwo; 3" // same as q"1; 2; 3" If there is no block it will be equivalent to $ unquoting: val one = q"1" val onetwo = q"..$one; 2" // same as q"1; 2" But the inconsistency here is that currently only terms support this single-element semantics. This commit extends this functionality to also support definitions and imports. So that following code works: val q1 = q"val x = 1" val q2 = q"..$q1; val y = 2" // same as q"val x = 1; val y = 2"
* | | | | Merge pull request #3863 from adriaanm/rebase-3852Adriaan Moors2014-07-031-10/+36
|\ \ \ \ \ | | | | | | | | | | | | Document SuperAccessors
| * | | | | Document SuperAccessorsMartin Odersky2014-07-031-10/+36
|/ / / / / | | | | | | | | | | | | | | | | | | | | Added comment giving an up-to-date overview of SuperAccessors and how we might want to change it.
* | | | | Merge pull request #3828 from retronym/ticket/8675Adriaan Moors2014-07-035-1/+64
|\ \ \ \ \ | | | | | | | | | | | | SI-8675 Avoid unreported error after second try using implicit view
| * | | | | SI-8675 Add another test case for swallowed type errorsJason Zaugg2014-06-262-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As reported on scala-internals. After tightening up the treatment of undetermined type parameters in SI-7944, the enclosed test case no longer typechecks. And since the regression fixed in the previous commit, the error was swallowed by the typechecker only to be burped up by a crash in the backend.
| * | | | | SI-8675 Avoid unreported error after second try using implicit viewJason Zaugg2014-06-253-1/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is specific to situations in which we first typecheck an application `qual.m(arg)` against the method `m` directly provided by `qual`, and then fall back to `implicitView(qual).m(arg)`. Regressed in SI-3971 / 7fa77af, in which error reports were moved to the innermost `Apply`, and the check for `errorInResult` was accordingly changed to recurse through `Apply` trees. Before that change, we did not fall back to using a view. After the change, we do try a view. We retypecheck the arguments under the `retyping` mode (see `tryTypedArgs`), but this doesn't seem to be enough to avoid leaking the error typed nested trees from the first try. Here's an example from the enclosed test case: a.update(0, x[A]({new isString(true)})) `-- error typed refArrayOps(a).update(0, x[A]({new isString(true)})) ` `-- error type persists `-- this tree is retypecked by tryTypedArgs This commit changes `onError` to only proceed with the second try if the retyped argument trees are error free.
* | | | | | Merge pull request #3836 from gourlaysama/wip/t8292Grzegorz Kossakowski2014-07-011-3/+3
|\ \ \ \ \ \ | | | | | | | | | | | | | | SI-8292 report error when scaladoc fails to find doclet.
| * | | | | | SI-8292 report error when scaladoc fails to find doclet.Antoine Gourlay2014-07-011-3/+3
| | |_|_|_|/ | |/| | | |
* | | | | | Merge pull request #3849 from gourlaysama/wip/t8690Ichoran2014-06-293-1/+15
|\ \ \ \ \ \ | |/ / / / / |/| | | | | SI-8690 BufferedSource.mkString mistakenly skipped the first char.
| * | | | | SI-8690 BufferedSource.mkString mistakenly skipped the first char.Antoine Gourlay2014-06-293-1/+15
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mkString is overriden in BufferedSource for performance, but the implementation always used the wrong reader. This seems to be a typo (`allReader` is declared 5 lines earlier but never used, `charReader` is used in its place).
* | | | | Merge pull request #3778 from xeno-by/topic/plugins-is-blackboxJason Zaugg2014-06-277-1/+64
|\ \ \ \ \ | | | | | | | | | | | | adds MacroPlugin.pluginsIsBlackbox
| * | | | | adds MacroPlugin.pluginsIsBlackboxEugene Burmako2014-05-227-1/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is an important omission in the current macro plugin API, which was designed before the blackbox vs whitebox separation was implemented. Even if one overrides pluginsTypedMacroBody and pluginsMacroExpand, that would still be not enough to write a custom macro expander, because typedImplicit1 uses isBlackbox, which is tightly coupled with the standard way of reading/writing macro signatures.
* | | | | | Merge pull request #3780 from xeno-by/topic/rangepos-macro-argsJason Zaugg2014-06-275-2/+19
|\ \ \ \ \ \ | | | | | | | | | | | | | | macro args now correctly preserve range positions
| * | | | | | macro args now correctly preserve range positionsEugene Burmako2014-05-235-2/+19
| |/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Somewhen in the 2.11.0 development cycle we started duplicating macro arguments for increased robustness. What wasn't taken into account though is that Tree.duplicate destroys range positions. This commit fixes the problem. 2.10.x is unaffected by this bug, because it doesn't duplicate the args yet.
* | | | | | Merge pull request #3835 from Ichoran/issue/7562Jason Zaugg2014-06-271-2/+8
|\ \ \ \ \ \ | | | | | | | | | | | | | | SI-7562 Regex.findAllIn does not report all matches
| * | | | | | SI-7562 Regex.findAllIn does not report all matchesRex Kerr2014-06-261-2/+8
| | |_|_|_|/ | |/| | | | | | | | | | | | | | | | Changed findAllIn docs to clarify that it finds non-overlapping matches.
* | | | | | Merge pull request #3832 from jrudolph/w/fix-tailrecJason Zaugg2014-06-275-4/+97
|\ \ \ \ \ \ | | | | | | | | | | | | | | SI-8657 don't miss tailrec defs in more positions
| * | | | | | SI-8657 don't miss tailrec defs in more positionsJohannes Rudolph2014-06-255-4/+97
| | |_|/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1) First operand of boolean expression using `&&` or `||`. Second operands of those boolean exprs were already treated specially here but handling for first operands was missing. 2) Condition of `If`. Also added a test for guards.
* | | | | | Merge pull request #3749 from huitseeker/issue/DeprecWarningJason Zaugg2014-06-2762-73/+75
|\ \ \ \ \ \ | | | | | | | | | | | | | | SI-8185 Correct grammar for single-warning compilation run
| * | | | | | SI-8185 Correct grammar for single-warning compilation runFrançois Garillot2014-05-1462-73/+75
| | | | | | |
* | | | | | | Merge pull request #3758 from gourlaysama/wip/t7372Ichoran2014-06-262-8/+8
|\ \ \ \ \ \ \ | |_|_|/ / / / |/| | | | | | SI-7372 fix wrong insertion point for binary & linear search.
| * | | | | | SI-7372 make binarySearch methods use the same parameters for the same things.Antoine Gourlay2014-06-121-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The public facing binarySearch method used an inclusive 'from' parameter, while the internal @tailrec one used an *exclusive* 'from' parameter. No wonder there was an off-by-one error somewhere. This makes both methods use the same exclusive 'from' parameter.
| * | | | | | SI-7372 fix wrong insertion point for binary & linear search.Antoine Gourlay2014-06-042-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It should return the position the value would have if it was a part of the sequence. Somehow even the test was wrong.
* | | | | | | Merge pull request #3806 from clhodapp/fix/SI-6967Adriaan Moors2014-06-254-50/+96
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | SI-6967 Fix ClassTag unapply for primitives