summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Actually retract clashing synthetic apply/unapplyAdriaan Moors2017-04-122-1/+13
| | | | | | | | | | | | | | | | | | | | | | | The completer set the IS_ERROR flag and I assumed the typer dropped a synthetic tree with a symbol with that flag, because the tree was not shown in -Xprint output. It turns out, as explained by lrytz, that the mechanism was fragile because it relied on the order in which completers are run. We now cover both the case that: - the completer was run (and the `IS_ERROR` flag was set) before `addSynthetics` in `typedStat` iterates over the scope (since the symbol is already unlinked, the tree is not added, irrespective of its flags). For this case, we also remove the symbol from the synthetics in its unit. - the completer is triggered during the iteration in `addSynthetics`, which needs the check for the `IS_ERROR` flag during the iteration. Thankfully, the community build caught my mistake, and lrytz provided a good analysis and review. Fix scala/bug#10261
* Revert some of ade53a123. Use completer factory methods.Adriaan Moors2017-04-112-21/+22
| | | | | | | Scalameta et al need to be able to customize the type completer behavior, so we must use factory methods to instantiate them, rather than instantiating the classes directly.
* Merge pull request #5402 from som-snytt/issue/8040-unusedSeth Tisue2017-04-1017-93/+244
|\ | | | | SI-8040 Improve unused warnings
| * SD-363 Xlint no warn deprecated params, defaultsSom Snytt2017-04-061-4/+10
| | | | | | | | | | | | | | Deprecation is an escape hatch for unused params. Since default arg getters receive values of previous args, don't warn when they are unused.
| * SI-8040 Defer deprecation of -Ywarn-unused-importsSom Snytt2017-04-061-1/+1
| | | | | | | | So as not to complicate established builds in the wild.
| * SI-8040 Retreat on paramsSom Snytt2017-04-061-2/+5
| | | | | | | | | | | | Don't warn unused params when `-Xlint`. Don't disable under lint, so `-Ywarn-unused -Xlint` works.
| * SI-8040 No warn DummyImplicitSom Snytt2017-03-111-1/+2
| | | | | | | | It's just a dummy.
| * SI-8040 Xlint enables unused warningsSom Snytt2017-03-111-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | `-Ywarn-unused-import` is deprecated in favor of `-Ywarn-unused:imports`. `-Xlint` does not yet enable `-Ywarn-unused:patvars`. But the default for `-Ywarn-unused` is everything, including `patvars`. So `-Xlint:unused` is the populist option, `-Ywarn-unused` more exclusive. Tests are fixed by narrowing scope of `-Xlint` when specified.
| * SI-8040 No warn args to super, main argsSom Snytt2017-03-113-19/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | `class B(x: X) extends A(x)` uses `x` in ctor, where it is detectable as an ordinary param. `implicit class C(val s: String)` may not use `s` in extension methods, so don't warn. Don't warn required args to main method. Don't warn about synthetic isDefinedAt in anonymous functions, or about defaultCase$.
| * SI-8040 Avoid Null companionSom Snytt2017-03-111-2/+2
| | | | | | | | | | | | Don't warn on the private constructor of an abstract class. Instead, take it as a signal that the class must not be instantiated.
| * SI-7860 No warn private implicit value classSom Snytt2017-03-111-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | Previously, warned on unused synthetic companion. Also avoid false negative via hashcode reference to the underlying value. Avoid the synthetic conversion method for the implicit class (whose RHS always uses the class); the def itself is synthetic so is normally not warned.
| * SI-8040 Warn patvars in casedefsSom Snytt2017-03-112-21/+27
| | | | | | | | | | | | | | | | Collect bindings in casedefs unless "@-bound to _". Also minor refactor to make it easier to see the cases of `id @ _`. Tupled matching is supposed to be efficient either now or soon.
| * SI-9839 Avoid crash in macro import selector posSom Snytt2017-03-111-6/+4
| | | | | | | | | | | | Ignore bad name pos. Also delete unused val. Thanks, `-Ywarn-unused`!
| * SI-8040 Warn unused parametersSom Snytt2017-03-112-42/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | One can `-Ywarn-unused:params` or more narrowly warn only for unused implicit parameters with `-Ywarn-unused:implicits`. Params includes constructor parameters. The settings for privates and locals are not yet distinguished. ``` $ skalac -Ywarn-unused:help Enable or disable specific `unused' warnings imports Warn if an import selector is not referenced. patvars Warn if a variable bound in a pattern is unused. privates Warn if a private member is unused. locals Warn if a local definition is unused. params Warn if a value parameter is unused. implicits Warn if an implicit parameter is unused. ```
| * SI-8040 Warn unused flagsSom Snytt2017-03-118-19/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce `-Ywarn-unused:x,y,z` and exploit `-Ywarn-unused:patvars`. Although the tree attachment for shielding patvars from warnings is not structural, sneaking the settings flag into the reflection internal TreeGen is awkward. Add test to ensure isolation of patvars warning from others. `-Ywarn-unused-import` is an alias for `-Ywarn-unused:imports`. `-Xlint:unused` is an alias for `-Ywarn-unused`, but not enabled yet. The help text advises to use `-Ywarn-unused`. The future can decide if `-Xlint:unused-imports` is warranted.
| * SI-9158 No warn for comprehension patvarsSom Snytt2017-03-111-5/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Midstream assignments should not cause unused warnings. Currently the encoding doesn't pass them along, but passes the value from which they were destructured. For for-comprehensions only, the patvar transform tags the binds so that they are not warned if they turn up in a valdef and are unused. Extractors are invoked multiple times if the patvar is used later, as noted on the ticket. In a yield, the valdef is emitted only if the patvar is referenced (possibly saving the extra extraction), so there is no warning there currently.
| * SI-8040 Heeding -Ywarn-unusedSom Snytt2017-03-115-10/+8
| | | | | | | | | | | | | | Polish notation, as in shoe-shine, as recommended by the warning. Minor clean-ups as advocated by `Ywarn-unused` and `Xlint`.
| * SI-8040 Warn unused pattern varsSom Snytt2017-03-116-9/+33
| | | | | | | | | | | | | | | | | | | | | | | | Warn for unused `case X(x) =>` but, as an escape hatch, not for `case X(x @ _) =>`. The latter form is deemed documentary. (Named args could serve a similar purpose, `case X(x = _) =>`.) An attachment is used to mark the bound var, and the symbol position is used to correlate the identifier with the variable that is introduced. This mechanism doesn't work yet when only a single var is defined.
| * SI-8040 Improve unused warningsSom Snytt2017-03-111-7/+26
| | | | | | | | | | | | | | Add symbol names, don't warn for both getters and setters or for synthetics (except default arg getters). Tweak messages for readability.
* | Merge pull request #5816 from adriaanm/userdefined-apply-212Adriaan Moors2017-04-105-202/+293
|\ \ | | | | | | Allow user-defined `[un]apply` in case companion
| * | Boy scout mkTypeCompleterAdriaan Moors2017-04-062-118/+143
| | | | | | | | | | | | | | | Create named subclasses, preserve factory methods for external users. Make explicit that TypeCompleterBase is not meant for wrapping.
| * | Use CompleterWrapper for implicitFactoryMethodCompleterAdriaan Moors2017-04-062-7/+8
| | | | | | | | | | | | | | | mkTypeCompleter is not suitable for wrapping potentially polymorphic completers
| * | Clean up copyMethodCompleter, capture lessAdriaan Moors2017-04-061-8/+8
| | |
| * | Refactor to reduce assignSymbol indirectionAdriaan Moors2017-04-063-55/+37
| | | | | | | | | | | | | | | | | | - remove logging wrapper that also does important work - `assignAndEnterSymbol(tree)` --> `enterInScope(assignMemberSymbol(tree))` - reduce redundant type test (we know it's an import/package/member)
| * | Create scope only onceAdriaan Moors2017-04-061-6/+7
| | |
| * | `CompleterWrapper` delegates `typeParams`.Adriaan Moors2017-04-061-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes the problem reported with #5730 by xuwei-k in scala/scala-dev#352. The problem was already present before the introduction of `applyUnapplyMethodCompleter`, as 63f7b35 (in #5294) introduced a similar bug where the `PolyTypeCompleter`'s `typeParams` override was masked.
| * | Improvements based on reviews by Lukas & JasonAdriaan Moors2017-04-062-17/+45
| | |
| * | Allow user-defined `[un]apply` in case companionAdriaan Moors2017-04-051-24/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't emit a synthetic `apply` (or `unapply`) when it would clash with an existing one. This allows e.g., a `private apply`, along with a `case class` with a `private` constructor. We have to retract the synthetic method in a pretty roundabout way, as we need the other methods and the owner to be completed already. Unless we have to complete the synthetic `apply` while completing the user-defined one, this should not be a problem. If this does happen, this implies there's a cycle in computing the user-defined signature and the synthetic one, which is not allowed.
* | | Fix Greek Mythology references in compiler packageJanek Bogucki2017-04-1015-24/+24
| | | | | | | | | | | | | | | | | | | | | Improve documentation some packages and correct some typos in these directories, - compiler - library
* | | Revert "Optimize slice and take in ArrayOps, WrappedArray"Adriaan Moors2017-04-072-114/+11
| | | | | | | | | | | | This reverts commit d540bf01fe4d9e5c56a68b0d3bada9d97af77e3f.
* | | Revert "Optimised implementation of List.filter/filterNot"Adriaan Moors2017-04-073-107/+1
| | | | | | | | | | | | This reverts commit eb5c51383a63c5c3420e53ef021607ff5fd20296.
* | | Revert "Handle WrappedArray the same way as ArrayOps for binary compatibility"Adriaan Moors2017-04-071-23/+21
| | | | | | | | | | | | This reverts commit f24c2603d0acee5bcb6d5d80bf1e1a4645fa74f0.
* | | Merge 2.11.x into 2.12.xAdriaan Moors2017-04-071-19/+22
|\ \ \ | | | | | | | | | | | | Include 99f41a1 Merge pull request #5736
| * \ \ Merge pull request #5736 from adriaanm/t10206Adriaan Moors2017-03-211-19/+22
| |\ \ \ | | | | | | | | | | SI-10206 tighten fix for SI-6889
| | * | | SI-10206 tighten fix for SI-6889Adriaan Moors2017-02-231-19/+22
| | | | | | | | | | | | | | | | | | | | | | | | | There are more supertypes of `AnyRef` than you might think: `?{def clone: ?}` is one example...
| * | | | [backport] new repo, version numbers for integration buildsLukas Rytz2017-03-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Integration builds now have version number like `2.12.2-bin-sha7` or `2.13.0-pre-sha7` and are published to scala-integration (no longer scala-release-temp). scala-release-temp is still used in the bootstrap script for publishing locker.
* | | | | Merge 2.11.x into 2.12.xAdriaan Moors2017-04-073-3/+3
|\| | | | | |_|/ / |/| | | | | | | Include 828a892 Merge pull request #5753
| * | | Merge pull request #5753 from Philippus/issue/copyright_yearSeth Tisue2017-03-063-3/+3
| |\ \ \ | | | | | | | | | | bump copyright year to 2017 [ci: last-only]
| | * | | bump copyright year to 2017Philippus Baalman2017-03-023-3/+3
| | |/ /
| * | | Improvements based on reviews by Lukas & JasonAdriaan Moors2017-03-022-17/+45
| | | |
| * | | Allow user-defined `[un]apply` in case companionAdriaan Moors2017-02-271-12/+69
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't emit a synthetic `apply` (or `unapply`) when it would clash with an existing one. This allows e.g., a `private apply`, along with a `case class` with a `private` constructor. We have to retract the synthetic method in a pretty roundabout way, as we need the other methods and the owner to be completed already. Unless we have to complete the synthetic `apply` while completing the user-defined one, this should not be a problem. If this does happen, this implies there's a cycle in computing the user-defined signature and the synthetic one, which is not allowed.
* | | Merge pull request #5811 from milessabin/topic/implicitinfo-hashcodeJason Zaugg2017-04-051-1/+4
|\ \ \ | | | | | | | | Make ImplicitInfo hashCode consistent with equals.
| * | | Make ImplicitInfo hashCode consistent with equals.Miles Sabin2017-04-031-1/+4
| | | |
* | | | Merge pull request #5773 from wpopielarski/2.12.xAdriaan Moors2017-04-042-1/+13
|\ \ \ \ | | | | | | | | | | Adds three Java 8 new Constant Pool structures to scalap.
| * | | | Adds three Java 8 new Constant Pool structures to scalap.wpopielarski2017-03-132-1/+13
| | |_|/ | |/| |
* | | | Merge pull request #5813 from viktorklang/wip-improve-await-docs-√Seth Tisue2017-04-042-26/+59
|\ \ \ \ | | | | | | | | | | Improving ScalaDoc for ExecutionContexts
| * | | | Improving ScalaDoc for ExecutionContext and Await.Viktor Klang2017-03-292-26/+59
| | |/ / | |/| |
* | | | Merge pull request #5817 from ashawley/java-converters-typoSeth Tisue2017-03-311-6/+6
|\ \ \ \ | | | | | | | | | | Fix typo in JavaConverters doc
| * | | | Fix typo in JavaConverters docAaron S. Hawley2017-03-311-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is no such thing as scala.collection.mutable.concurrent.Map error: object concurrent is not a member of package scala.collection.mutable Introduced in 2908236a
* | | | | Merge pull request #5802 from jrudolph/jr/w/ListBuffer-isEmpty-nonEmptyLukas Rytz2017-03-301-0/+4
|\ \ \ \ \ | |_|/ / / |/| | | | Implement ListBuffer.isEmpty / nonEmpty / head efficiently