summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #4175 from Ichoran/issue/7981Lukas Rytz2014-12-045-18/+59
|\ | | | | SI-7981 toSeq on immutable Map and Set return ArrayBuffer
| * SI-7981 toSeq on immutable Map and Set return ArrayBufferRex Kerr2014-11-305-18/+59
|/ | | | | | | | | | Switched to `Vector` for the default `MapLike`/`SetLike`, then back again in `mutable.MapLike`/`mutable.SetLike`. Preliminary performance testing indicates an across-the-board improvement due to cutting out a great deal of indirection. In the case of empty immutable maps or sets, the improvement is enormous: it quickly returns Vector.empty instead of jumping through all sorts of hoops to eventually create an empty `ArrayBuffer`. One possible downside is that `Vector` is pretty memory-hungry for small collections. Need to evalute this; rather than abandoning this change, it's probably better to make `Vector` smarter about small collections. Also fixed test with literal "ArrayBuffer" in output (`s/ArrayBuffer/Vector/g`).
* Merge pull request #4156 from Ichoran/issue/8819Grzegorz Kossakowski2014-11-261-1/+18
|\ | | | | SI-8819 Range slice does not return a Range
| * SI-8819 Range slice does not return a RangeRex Kerr2014-11-251-1/+18
| | | | | | | | Added an override to the `slice` method that creates a `Range`. No tests (except verifying by hand that it solves the bug); scala-collections-laws found and will test this.
* | Merge pull request #4157 from Ichoran/issue/8814Grzegorz Kossakowski2014-11-262-0/+36
|\ \ | | | | | | SI-8814 mutable.LongMap loses its LongMapness when adding with +
| * | SI-8814 mutable.LongMap loses its LongMapness when adding with +Rex Kerr2014-11-242-0/+36
| |/ | | | | | | | | | | Added overrides for +, ++, and updated to both LongMap and AnyRefMap. No tests; this was caught by scala-collections-laws.
* | Merge pull request #4158 from Ichoran/issue/8765Grzegorz Kossakowski2014-11-262-16/+16
|\ \ | | | | | | SI-8765 immutable.HashSet exposes internal updated0 method
| * | SI-8765 immutable.HashSet exposes internal updated0 methodRex Kerr2014-11-242-16/+16
| |/ | | | | | | | | | | | | | | Made most internal methods protected or private[immutable], as appropriate. (Coverage was scattershot before.) updated0 is private[collection] since it is used by ParHashSet. (Not sure how wise this is for maintainability, but let's not rock this boat now.) No deprecation, as there was no real way to sanely use these. No test, as this is better caught by inspection than compilation failure tests.
* | Merge pull request #4159 from Ichoran/issue/8727Grzegorz Kossakowski2014-11-262-1/+16
|\ \ | |/ |/| SI-8727 Map.filterKeys result's contains and get are inconsistent
| * SI-8727 Map.filterKeys result's contains and get are inconsistentRex Kerr2014-11-252-1/+16
|/ | | | Changed documentation and code so that predicate for filterKeys is always applied before the map is queried.
* Merge pull request #4124 from retronym/ticket/7521Grzegorz Kossakowski2014-11-215-1/+43
|\ | | | | SI-7521 Fix erasure of parametric value classes.
| * SI-7521 Fix erasure of parametric value classes.Jason Zaugg2014-11-105-1/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `Erasure.boxingErasure` exists to ensure that we use boxed primitives to represent the value, if the value class has type parameters referred to by its element type. However, this is implenented with a type map that runs deeply across the type. In the enclosed test case, we have `Repr=Array[Int]`, which should be erased to `Array[Int]`, _not_ to `Array[Integer]`. This commit ensures that the `boxingErasure` map only applies boxing at the top level, and not within array arguments. (Other type arguments will be erased, so we don't have to deal with them.)
* | Merge pull request #4140 from som-snytt/issue/8251Grzegorz Kossakowski2014-11-213-13/+1
|\ \ | | | | | | SI-8251 Remove ListBuffer.readOnly as deprecated
| * | SI-8251 Remove ListBuffer.readOnly as deprecatedSom Snytt2014-11-203-13/+1
| | | | | | | | | | | | Complete the story arc.
* | | Merge pull request #4086 from som-snytt/issue/8835-2.12.xGrzegorz Kossakowski2014-11-213-22/+72
|\ \ \ | |/ / |/| | SI-8835 Lazier slice for Iterator
| * | SI-8835 Lazier slice for IteratorSom Snytt2014-11-133-22/+72
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | An iterator for slicing that does not drop eagerly. A series of `take m drop n` that results in nothing taken will not call the underlying iterator. Chained invocations do not create intermediate iterators. This PR against 2.12 (because of the change to laziness) does not include the expanded unit test from #4075. Fix the parallel iterable splitter, which overrides `take` and `slice`, to also override `drop`. Drop is now eager there, like the drop of slice. Enhance `stringOf` to handle `ParIterable` again. A commit from a previous decade added that under the aegis of `Iterable`. As of 2.11, `stringOf((0 until 512).to[Vector].par, 10)` does not truncate.
* | Merge pull request #4001 from retronym/ticket/8862Jason Zaugg2014-11-1914-82/+140
|\ \ | |/ |/| SI-8862 Fix treatment of inherited implicits in package objects
| * More uniform treatment of package objectsJason Zaugg2014-11-0713-85/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Introduce `Symbol#packageObject` and `Type#packageObject` to lookup the member package object of a package class/module, and use this far and wide. - Replace the overly complicated (and still buggy) implementation of `Context#isInPackageObject` with a one liner. The simplifying insight is that if we select a symbol from a package prefix that does not own that symbol, it *must* have really been selected from the package object. - Change implicit search to use the cache in `ModuleSymbol#implicitMembers` via `Type#implicitMembers`, which lets the client code read more naturally. Fixes a bug with `adapt::insertApply` that Adriaan spotted in a feat of lateral thinking. This is tested in t8862b.scala. alladin763.scala adds the test case from the bug originally remedied by `insertApply` to check we haven't regressed.
| * SI-8862 Fix treatment of inherited implicits in package objectsJason Zaugg2014-11-074-10/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Two spots in implicit search fell prey to a trap with package objects. Members of a package object are entered into the scope of the enclosing package, but that doesn't form a suitable prefix for determing the member type. A REPL transcript paints a picture that speaks a 1000 words: ``` scala> :paste -raw // Entering paste mode (ctrl-D to finish) package p { class C[A] { def foo: A = ??? }; object `package` extends C[String] } // Exiting paste mode, now interpreting. scala> val p = rootMirror.getPackageIfDefined("p") warning: there was one deprecation warning; re-run with -deprecation for details p: $r.intp.global.Symbol = package p scala> p.info.decls res0: $r.intp.global.Scope = Scopes(class C, package object p, method foo) scala> val foo = p.info.decl(TermName("foo")) foo: $r.intp.global.Symbol = method foo scala> p.typeOfThis memberType foo res1: $r.intp.global.Type = => A scala> val fooOwner = foo.owner fooOwner: $r.intp.global.Symbol = class C scala> p.info.decl(nme.PACKAGE).typeOfThis memberType foo res3: $r.intp.global.Type = => String ``` This commit detects if we find an implicit in a package module, and then uses the self type of the corresponding package object as the prefix for the `ImplicitInfo`. This is done in both `Context.implicitss` (which collects in-scope implicits), and in `companionImplicitMap` (which harvests them from the implicit scope.) In addition, it was necessary / possible to remove a special case that excluded package object implicits, the referenced tests for SI-3999 now pass without this.
* | Merge pull request #3981 from retronym/ticket/8575-2Lukas Rytz2014-11-074-1/+81
|\ \ | |/ |/| SI-8575 Fix subtyping transitivity with aliases, compound types
| * SI-8575 Fix subtyping transitivity with aliases, compound typesJason Zaugg2014-11-074-1/+81
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Thanks to @b-studios and @Blaisorblade for investigation into this bug. `RefinedType#normalize` is responsible for flattening nested compound types to a flat representation. Types are normalized during `=:=` in search of a successful result. This means that `((A with B) with C) =:= (A with B with C)`. However, if we introduce a type alias for `A with B` on the LHS, the attempt at flattening is thwarted. This commit changes normalization of refined types. If a parent is an alias for another refined type, it is dealiased during the flattening process. Two tests are included. The first demonstrates a symptom of this problem: failure to install a bridge method resulted in a linkage error. The second test uses the reflection API to directly show transitivity of subtyping now holds. Targetting at 2.12, as bug fixes in subtyping usually can be shown to lead to binary incompatibilities between code using the old and new compilers.
* Merge pull request #4090 from retronym/ticket/8955Jason Zaugg2014-11-062-3/+21
|\ | | | | SI-8955 Fix hanging fork-join pool via parallel collections
| * SI-8955 Fix hanging fork-join pool via parallel collectionsJason Zaugg2014-11-052-3/+21
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A recent change [1] to Scala's default fork join thread pool caused intermittent deadlocks. This is only visible in the development series of Scala, 2.12.0-SNAPSHOT. We changed our thread factory to place a hard limit the number of threads created (equal to the desired parallelism.) I have extracted a test case [2] that uses jsr166e directly, rather than using Scala's parallel collections and abstractions on top of FJ. In the comments of the bug, Viktor suggests this was too aggressive and instead we ought to increase the limit to parallelism + 256 (with a system property override.) He explained: > The number 256 is going to be the default for the max threads for > FJP in Java9 (down from 32k) so this change will harmonize the > settings while making it possible to override from the outside. > > The cause of the deadlock is twofold: > > 1) The test uses ExecutionContext.global, which is not designed > for typical ForkJoin workloads since it has async = true > (FIFO instead of LIFO) > 2) And we capped the default max number of threads to be created > when doing managed blocking from 32k to number of cores > (a tad too aggressive it seems) Through testing, I found that for this example I could trigger the hang with: parallelismLevel | maxThreads ----------------------------- 2 | <= 4 4 | <= 9 8 | <= 11 16 | <= 15 I have emailed concurrency-interest [3] to help analyse the problem further, but in the interest of avoiding hangs in the scalacheck/parallel-collections test, I'm implementing Viktor's suggestion in the interim. [1] https://github.com/scala/scala/pull/4042 [2] https://gist.github.com/retronym/2e14cdab6d5612562d95 [3] http://markmail.org/message/czphdyjxpkixeztv
* Merge pull request #4042 from viktorklang/wip-sip14-updates-√Adriaan Moors2014-10-2326-431/+1105
|\ | | | | SIP-14 improvements
| * SI-8849 Makes `ExecutionContext.Implicits.global` ambiguousViktor Klang2014-10-203-2/+19
| | | | | | | | | | | | There was an unfortunate side-effect from having `Implicits.global` be of type `ExecutionContextExecutor`; it is more specific than `ExecutionContext`, as such it would be picked over other `ExecutionContexts` in the implicit scope.
| * Add missing canonical combinators:Viktor Klang2014-10-2024-429/+1086
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - `def transform[S](f: Try[T] => Try[S])(implicit executor: ExecutionContext): Future[S]` - `def transformWith[S](f: Try[T] => Future[S])(implicit executor: ExecutionContext): Future[S]` - `def flatten[S](implicit ev: T <:< Future[S]): Future[S]` - `def zipWith[U, R](that: Future[U])(f: (T, U) => R)(implicit executor: ExecutionContext): Future[R]` Add missing utilities: - `val unit: Future[Unit]` in `object Future` - `object never extends Future[Nothing]` in `object Future` - `def defaultBlockContext: BlockContext` in `object BlockContext` - `def toString: String` on stdlib implementations of `Future` Refactors: - the `scala.concurrent.Future` trait to not explicit create any `Promises`, so that implementations can control implementation type, this is mainly facilitated through adding of the `transform` and `transformWith` methods. - the implementation of `ExecutionContextImpl` has been cleaned up - the `scala.concurrent.impl.DefaultPromise` has been reimplemented to not use `sun.misc.Unsafe` Securing: - Add a self-check in `completeWith` and `tryCompleteWith` to avoid cycles in trait Promise - Capping the maximum number of threads for the global `ExecutionContext` to the max parallelism - Implementing (almost) all `Future` combinators on `transformWith` and `transform` means that `DefaultPromise` linking works on both `(flat)map` and `recover(With)` - Nested `blocking {}` should not spawn extra threads beyond the first. Removes: - the private `internalExecutor` method in favor of an import in trait `Future` - the private `internalExecutor` method in favor of an import in trait `Promise` - the `AtomicReferenceFieldUpdater` in `AbstractPromise` since we're using `Unsafe` - `scala.concurrent.impl.Future` is no longer needed Deprecates: - `Future.onSuccess` - discourage the use of callbacks (and is also redundant considering `foreach` and `onComplete`) - `Future.onFailure` - discourage the use of callbacks (and is also redundant considering `onComplete` and `failed.foreach`) - `ExecutionContext.prepare` - it was ill specced and it is too easy to forget to call it (or even know when to call it or call it more times than needed) - All classes in scala.concurrent.forkjoin. Scala 2.12 will be Java 8+ and as such the jsr166e should be used as included in java.util.concurrent. Reimplements: - `failed` - in terms of `transform` - `map` - in terms of `transform` - `flatMap` - in terms of `transformWith` - `recover` - in terms of `transform` - `recoverWith` - in terms of `transformWith` - `zip` - in terms of `flatMap` + `map` - `fallbackTo` - in terms of `recoverWith` + `recoverWith` - `andThen` - in terms of `transform` Miscellaneous: - Giving the threads of `ExecutionContext.global` sensible names - Optimizes `object Future.successful` and `object Future.failed` are now separate implementations, to optimize for the result, avoiding doing work for the "other branch". - Optimizes `compressedRoot()` by avoiding double-calls to volatile get. Documentation: - Almost all methods on `Future` and `Promise` have been revisited and had their ScalaDoc updated Tests: - Yes
* Merge pull request #4012 from retronym/merge/2.11.x-to-2.12.x-20140930Lukas Rytz2014-09-3061-818/+1476
|\ | | | | Merge 2.11.x to 2.12.x
| * Merge remote-tracking branch 'origin/2.11.x' into ↵Jason Zaugg2014-09-3061-818/+1476
|/| | | | | | | merge/2.11.x-to-2.12.x-20140930
| * Merge pull request #3996 from gourlaysama/wip/specJason Zaugg2014-09-2914-11/+690
| |\ | | | | | | spec: generated TOC, with linkable headers and return to top links
| | * spec: a header that links to the index, with a scala logoAntoine Gourlay2014-09-236-5/+60
| | | | | | | | | | | | ...and a Scala favicon.
| | * spec: a print stylesheet to remove the TOC when printingAntoine Gourlay2014-09-232-0/+16
| | |
| | * spec: generated TOC with linkable headersAntoine Gourlay2014-09-229-7/+615
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a table of contents to the spec, with a way to get the link of a header on hover (like on GitHub) and a "return to top" small icon at the end of each section. Jekyll generates the H1-level table of contents, and then the current one is expended using jQuery all the way down to H5 titles. Examples and H6 headers are ignored. GitHub's (MIT licensed) octicons are used for nice "link" and "up" icons.
| * | Merge pull request #4009 from gourlaysama/wip/test-flagsJason Zaugg2014-09-294-4/+0
| |\ \ | | | | | | | | Cleanup a few compiler flags in test/files/
| | * | Cleanup a few flags in test/files/Antoine Gourlay2014-09-294-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * String interpolation isn't Xexperimental anymore A few useless Xexperimental flags in tests were left behind by 6917cca, after string interpolation was made non-experimental in 983f414. * things added under -Xfuture in 2.10 are very much Xpresent now, the flag isn't needed anymore.
| * | | Merge pull request #4007 from retronym/topic/bump-timeoutGrzegorz Kossakowski2014-09-291-1/+1
| |\ \ \ | | | | | | | | | | Bump timeout in interactive tests from 10s -> 30s.
| | * | | Bump timeout in interactive tests from 10s -> 30s.Jason Zaugg2014-09-291-1/+1
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | Seeing too many of these failures on our build servers. https://scala-webapps.epfl.ch/jenkins/view/2.N.x/job/scala-nightly-auxjvm-2.11.x/148/jdk=jdk8,label=auxjvm/console This is most likely due to load on the machines.
| * | | Merge pull request #4006 from retronym/topic/defragilityJason Zaugg2014-09-282-3/+2
| |\ \ \ | | |/ / | |/| | Avoid test fragility to changes in Predef
| | * | Avoid test fragility to changes in PredefJason Zaugg2014-09-282-3/+2
| |/ / | | | | | | | | | | | | | | | The check file used to contain a stack trace entry from Predef with a line number. I've made the macro fail in a different manner that avoids this fragility.
| * | Merge pull request #4002 from retronym/merge/2.10.x-to-2.11.x-20140925Jason Zaugg2014-09-250-0/+0
| |\ \ | | | | | | | | Merge 2.10.x to 2.11.x
| | * | Merge remote-tracking branch 'origin/2.10.x' into ↵Jason Zaugg2014-09-250-0/+0
| |/| | | | | | | | | | | | | | merge/2.10.x-to-2.11.x-20140925
| | * | Merge pull request #3998 from retronym/backport/7756Grzegorz Kossakowski2014-09-248-8/+69
| | |\ \ | | | | | | | | | | [backport] SI-7756 Uncripple refchecks in case bodies
| | | * | [backport] SI-7756 Uncripple refchecks in case bodiesJason Zaugg2014-09-238-8/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In 65340ed4ad2e, parts of RefChecks were disabled when we traversed into the results of the new pattern matcher. Similar logic existed for the old pattern matcher, but in that case the Match / CaseDef nodes still existed in the tree. The new approach was too broad: important checks no longer scrutinized the body of cases. This commit turns the checks back on when it finds the remnants of a case body, which appears as an application to a label def. Conflicts: src/compiler/scala/tools/nsc/typechecker/RefChecks.scala Cherry pick of 3df1d77fc984b976efa68098206e801cf3b83a9e
| * | | | Merge pull request #3999 from mpociecha/classpath-findSourceFile-method-renamingGrzegorz Kossakowski2014-09-244-5/+4
| |\ \ \ \ | | | | | | | | | | | | Rename ClassPath.findSourceFile and delete Platform.doLoad
| | * | | | Get rid of Platform.doLoad method.Grzegorz Kossakowski2014-09-241-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | Since .NET backend got removed this method is a no-op.
| | * | | | Rename ClassPath.findSourceFile to ClassPath.findClassFileGrzegorz Kossakowski2014-09-243-4/+4
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If you look at the implementation of that method and its usage its clear that it should have been named `findClassFile` from the beginning because that's what it does: find a class file and not a source file.
| * | | | Merge pull request #3994 from puffnfresh/feature/system-compiler-propertiesGrzegorz Kossakowski2014-09-242-4/+4
| |\ \ \ \ | | | | | | | | | | | | Make compiler.properties fall back to prefixed
| | * | | | Make compiler.properties fall back to prefixedBrian McKenna2014-09-222-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, if we wanted to override the shell.prompt property, we had to modify compiler.properties in the jar. This change lets us do the following, instead: scala -Dscala.shell.prompt="$(echo -e "\npuffnfresh> ")" All properties previously loaded from compiler.properties now fall back to "scala." in the system properties when not found.
| * | | | | Merge pull request #3997 from krystiannowak/patch-1Jason Zaugg2014-09-231-1/+1
| |\ \ \ \ \ | | |_|_|_|/ | |/| | | | HasSet to HashSet typo fix
| | * | | | HasSet to HashSet typo fixKrystian Nowak2014-09-221-1/+1
| |/ / / /
| * | | | Merge pull request #3990 from som-snytt/issue/spec-overload-titleJason Zaugg2014-09-221-1/+1
| |\ \ \ \ | | |/ / / | |/| | | Particular formatting improvement in the spec