summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* 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 #3792 from som-snytt/issue/8525Lukas Rytz2014-07-1628-75/+318
|\ | | | | SI-8525 -Xlint:nowarn-missing-interpolator
| * SI-8525 No anonymous lintSom Snytt2014-07-1016-40/+122
| | | | | | | | | | | | | | | | | | Turn anonymous references to `settings.lint` into named settings. After that, trust to Adriaan to make them filterable. There are a few remaining top-level -Y lint warnings that are deprecated.
| * SI-8525 Add -Xlint:-warn-missing-interpolatorSom Snytt2014-07-0814-59/+123
| | | | | | | | | | | | | | | | | | | | Turn off lint warnings with negating prefix, and add a lint-only warning for the infamously nagging "Did you forget the interpolator?" That message is made more dignified. Without `-Xlint:false`, there is no mechanism to turn off anonymous linters once `-Xlint` is selected.
| * SI-8616 Error on -deprecation:true,falseSom Snytt2014-07-081-2/+3
| | | | | | | | | | | | | | | | This is an error, not a crash. Alternatively, one could define the multivalued colon case as equivalent to specifying the option multiple times. That would be very regular. But sometimes it's nicer just to error out.
| * SI-8610 -Xlint is multichoice optionSom Snytt2014-07-0812-20/+116
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make -Xlint a "multichoice" option for purposes of option parsing. This allows turning on "lint with these warnings" instead of only "turn off these warnings but enable other lint warnings". ``` $ scalac -Xlint:warn-adapted-args linty.scala # lint plus a warning $ scalac -Xlint warn-adapted-args linty.scala # same $ scalac -Xlint linty.scala # same as now $ scalac -Xlint -- linty.scala # ok, not necessary $ scalac -Xlint _ -- linty.scala # another funky underscore ``` This would also enable Xlint options that are not standalone options, although that is not implemented in this commit. For example, `-Xlint:no-missing-interpolator` could be used to disable that warning. (There is no `-Xoption:flavor=off` syntax.) (`no-` switches would not be enabled by `_`.)
* | Merge pull request #3883 from gourlaysama/wip/t8557Vlad Ureche2014-07-154-2/+35
|\ \ | | | | | | SI-8557 make scaladoc normalize paths of external jars.
| * | SI-8557 make scaladoc normalize paths of external jars.Antoine Gourlay2014-07-154-2/+35
| | | | | | | | | | | | | | | | | | Scaladoc compares (string representations of) the paths from -doc-external-doc and the paths form `sym.underlyingSource`. We now normalize on both ends before comparing them.
* | | Merge pull request #3817 from phaller/topic/typetagsLukas Rytz2014-07-1510-35/+99
|\ \ \ | | | | | | | | SI-5919 TypeTags and Exprs should be serializable
| * | | Add SerialVersionUID to SerializedTypeTag and SerializedExprPhilipp Haller2014-07-152-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The reason for adding the SerialVersionUID annotations is to be able to provide serialization stability throughout the 2.11.x series. And since type tags (and exprs) have not been serializable before, this does not break serialization for existing code.
| * | | SI-5919 TypeTags and Exprs should be serializablePhilipp Haller2014-07-1510-35/+99
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Make TypeCreator and TreeCreator extend Serializable. - When replacing a SerializedTypeTag with a TypeTag or WeakTypeTag, do not use scala.reflect.runtime.universe.rootMirror, since it is unlikely to find user classes; instead, create a runtime mirror using the context ClassLoader of the current thread. Use the same logic for SerializedExpr. - Remove writeObject/readObject methods from SerializedTypeTag and SerializedExpr since they are unused. - Add @throws annotation on writeReplace and readResolve methods. - Handle SecurityException if the current thread cannot access the context ClassLoader. - To make type tags of primitive value classes serializable, make PredefTypeCreator a top-level class. Otherwise, it would retain a reference to the enclosing Universe, rendering the TypeCreator non-serializable. Binary compatibility: - Keep nested PredefTypeCreator class to avoid backward binary incompatible change. - Keep `var` modifiers on the class parameters of SerializedTypeTag for backward binary compatibility. - Adds filter rules to forward binary compatibility whitelist: - `TypeCreator`, `PredefTypeCreator`, and `TreeCreator` must now extend from `Serializable`. - Must have new class `scala.reflect.api.PredefTypeCreator` to avoid problematic outer reference.
* | | | Merge pull request #3858 from densh/si/8703Jason Zaugg2014-07-153-5/+19
|\ \ \ \ | | | | | | | | | | SI-8703 add support for blocks with just a single expression to quasiquotes
| * | | | Address pull request feedbackDenys Shabalin2014-07-141-1/+3
| | | | |
| * | | | SI-8703 add support for blocks with just a single expression to quasiquotesDenys Shabalin2014-07-023-5/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously it was impossible to match a block that was constructed as Block(Nil, term) Due to the fact that quasiquotes always flatten those into just term. This is a correct behaviour for construction (for sake of consistency with parser) but doing it in deconstruction mode make it impossible to match such blocks which could have been constructed manually somewhere. To fix this we just disable block flattening in deconstruction mode. Interestingly enough this doesn't break existing code due to the fact that quasiquote's block matcher also matches expressions as single-element blocks. This allows to match single-element blocks with patterns like q"{ $foo }".
* | | | | Merge pull request #3882 from adriaanm/jline-2.12Lukas Rytz2014-07-152-2/+1
|\ \ \ \ \ | | | | | | | | | | | | Bump jline version to 2.12 (Re: SI-8535)
| * | | | | Bump jline version to 2.12 (Re: SI-8535)Adriaan Moors2014-07-152-2/+1
| | |/ / / | |/| | | | | | | | | | | | | Move version info where it belongs: versions.properties
* | | | | Merge pull request #3845 from xeno-by/topic/attachment-subclassingJason Zaugg2014-07-154-1/+23
|\ \ \ \ \ | | | | | | | | | | | | relaxes attachment-matching rules
| * | | | | relaxes attachment-matching rulesEugene Burmako2014-07-104-1/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It came as a surprise recently, but attachments.contains/get/update/remove require the class of the payload to match the provided tag exactly, not taking subclassing into account. This commit fixes the oversight.
* | | | | | Merge pull request #3844 from xeno-by/topic/rangepos-subpatternsJason Zaugg2014-07-155-1/+26
|\ \ \ \ \ \ | |_|/ / / / |/| | | | | prevents c.internal.subpatterns from destroying rangeposes
| * | | | | prevents some reflection APIs from destroying rangeposesEugene Burmako2014-07-105-1/+26
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit continues the work started in fcb3932b32. As we've figured out the hard way, exposing internally maintained trees (e.g. macro application) to the user is dangerous, because they can mutate the trees in place using one of the public APIs, potentially corrupting our internal state. Therefore, at some point we started duplicating everything that comes from the user and goes back to the user. This was generally a good idea due to the reason described above, but there was a problem that we didn't foresee - the problem of corrupted positions. It turns out that Tree.duplicate focuses positions in the tree being processed, turning range positions into offset ones, and that makes it impossible for macro users to make use of precise position information. I also went through the calls to Tree.duplicate to see what can be done to them. In cases when corruptions could happen, I tried to replace duplicate with duplicateAndKeepPositions. Some notes: 1) Tree rehashing performed in TreeGen uses duplicates here and there (e.g. in mkTemplate or in mkFor), which means that if one deconstructs a macro argument and then constructs it back, some of the positions in synthetic trees might become inaccurate. That's a general problem with synthetic trees though, so I don't think it should be addressed here. 2) TypeTree.copyAttrs does duplication of originals, which means that even duplicateAndKeepPositions will adversely affect positions of certain publicly accessible parts of type trees. I'm really scared to change this though, because who knows who can use this invariant. 3) Some methods that can be reached from the public API (Tree.substituteXXX, c.reifyXXX, c.untypecheck, ...) do duplicate internally, but that shouldn't be a big problem for us, because nothing is irreversibly corrupted here. It's the user's choice to call those methods (unlike with TypeTree.copyAttrs) and, if necessary, they can fixup the positions themselves afterwards. 4) Macro engine internals (macro impl binding creation, exploratory typechecking in typedMacroBody) use duplicate, but these aren't supposed to be seen by the user, so this shouldn't be a problem. 5) Certain parser functions, member syntheses and typer desugarings also duplicate, but in those cases we aren't talking about taking user trees and screwing them up, but rather about emitting potentially imprecise positions in the first place. Hence this commit isn't the right place to address these potential issues.
* | | | | Merge pull request #3872 from lrytz/no-adapted-argsLukas Rytz2014-07-155-11/+40
|\ \ \ \ \ | | | | | | | | | | | | Fix -Yno-adapted-args, it would just warn, not err
| * | | | | Fix -Yno-adapted-args, it would just warn, not errLukas Rytz2014-07-155-11/+40
| | | | | |